我想使用Terraform创建一个VPN,它具有固定的公共IP地址,我可以将其分配给Lambda函数。
我找到了这样做的博客文章和代码:
但是,当我运行脚本时,我会得到以下错误:
│ 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]
}我试过的事情:
我需要修改的剧本里有什么线索吗?
发布于 2021-12-15 10:11:52
natgateway.tf中有带有错误的字符串。修正后的版本如下:
resource "aws_nat_gateway" "natgateway" {
allocation_id = aws_eip.eip.id
subnet_id = aws_subnet.publicsubnet.id
tags = {
name = "prod nategatway"
}
depends_on = [aws_eip.eip]
}请注意,我不检查VPC或其其他资源的有效性。我只是在处理你报告的错误。
https://stackoverflow.com/questions/70360265
复制相似问题