【问题标题】:How can I fix the error with my terraform code?如何使用我的 terraform 代码修复错误?
【发布时间】:2021-12-06 12:03:59
【问题描述】:
on main.tf line 30, in resource "aws_route_table" "you-route":
route = [
{
cidr_block                         = ["0.0.0.0/0"]
gateway_id                        = aws_internet_gateway.you-gw.id
route                              = null
carrier_gateway_id                 = ""
destination_prefix_list_id         = ""
egress_only_gateway_id             = ""
instance_id                        = aws_instance.you-instance.id
ipv6_cidr_block                    = ""
local_gateway_id                   = ""
nat_gateway_id                     = ""
network_interface_id               = ""
transit_gateway_id                 = ""
vpc_endpoint_id                    = ""
vpc_peering_connection_id          = ""
},

{
ipv6_cidr_block                    = ["::/0"]
gateway_id                         = aws_internet_gateway.you-gw.id
route                              = null
carrier_gateway_id                 = ""
destination_prefix_list_id         = ""
egress_only_gateway_id             = ""
instance_id                        = aws_instance.you-instance.id
ipv6_cidr_block                    = ""
local_gateway_id                   = ""
nat_gateway_id                     = ""
network_interface_id               = ""
transit_gateway_id                 = ""
vpc_endpoint_id                    = ""
vpc_peering_connection_id          = ""
     }
]

aws_instance.you-instance.id 只有在应用后才会知道 aws_internet_gateway.you-gw.id 只有在申请后才会知道

属性“路由”的值不合适:元素 0:属性“cidr_block”:需要字符串。

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: terraform terraform-provider-aws


【解决方案1】:

cidr_block应该是这样的

cidr_block = "0.0.0.0/0"

【讨论】:

  • 您好托尼,感谢您坦诚的回复。我也试过了,仍然返回同样的错误。
  • @BlessedUyo 所有 cidr 块都应该是字符串,包括 thisipv6_cidr_block = "::/0"
  • 是的,我已经改了,但是还是没有解决问题。
  • 我不确定路由错误是怎么回事:属性“路由”的值不合适:元素 0:我没有路由,是的,但它在我的代码中定义为创建路由。跨度>
猜你喜欢
  • 2019-12-04
  • 2020-04-23
  • 1970-01-01
  • 1970-01-01
  • 2018-05-05
  • 1970-01-01
  • 2017-12-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多