[英]Terraform - Error creating NAT Gateway: InvalidElasticIpID.Malformed
我想使用 Terraform 創建一個具有固定公共 IP 地址的 VPN,我可以將其分配給我們的 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]
}
我嘗試過的事情:
我需要更改腳本中的任何線索或內容?
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 或其其他資源的有效性。 我只是解決您報告的錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.