【发布时间】:2022-01-18 10:29:19
【问题描述】:
我想使用 Terraform 创建一个具有固定公共 IP 地址的 VPN,我可以将其分配给我们的 Lambda 函数。
我找到了这篇博文和执行此操作的代码:
- 博文:https://jaffarshaik.medium.com/implementing-vpc-architecture-using-terraform-3de6c42d7646
- Github:https://github.com/Jaffarterraform786/vpc
但是,当我运行脚本时,我得到了这个错误:
│ Error: Error creating NAT Gateway: InvalidElasticIpID.Malformed: The elastic-ip ID 'aws_eip.ip.id' is malformed
│ status code: 400, request id: 96b26796-931d-4470-85b5-5c46c39889a9
│
│ with aws_nat_gateway.natgateway,
│ on natgateway.tf line 1, in resource "aws_nat_gateway" "natgateway":
│ 1: resource "aws_nat_gateway" "natgateway" {
这是natgateway.tf文件的内容:
resource "aws_nat_gateway" "natgateway" {
allocation_id = "aws_eip.ip.id"
subnet_id = "aws_subnet.publicsubnet.id"
tags = {
name = "prod nategatway"
}
depends_on = [aws_eip.eip]
}
我尝试过的事情:
- 在没有创建其他 VPC 的干净区域上运行脚本 - 仍然无法正常工作
- 在 Github 上提出了一个问题:https://github.com/Jaffarterraform786/vpc/issues/2
- 运行 Terraform 检查器以查看是否有任何错误,但未发现任何错误。
我需要更改脚本中的任何线索或内容?
【问题讨论】:
-
你实际运行的 TF 代码是什么?
-
@Marcin 我在github.com/Jaffarterraform786/vpc运行代码
标签: amazon-web-services terraform terraform-provider-aws amazon-vpc elastic-ip