最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon web services - Incorrect Attribute Type Error in Terraform for AWS Route Table (AWS Route Table and Internet Gateway) - S

programmeradmin1浏览0评论

I'm encountering an error while creating a route table in Terraform for AWS. My code looks correct, but I am receiving the following error:

Error: Incorrect attribute value type

on main.tf.json line 110, in resource.aws_route_table.public_rt:
  110:                 "route": [
  111:                     {
  112:                         "cidr_block": "0.0.0.0/0",
  113:                         "gateway_id": "${aws_internet_gateway.main_igw.id}"
  114:                     }
  115:                 ],
  Inappropriate value for attribute "route": element 0: attributes "carrier_gateway_id", "core_network_arn", "destination_prefix_list_id", "egress_only_gateway_id", "ipv6_cidr_block", "local_gateway_id", "nat_gateway_id", "network_interface_id", "transit_gateway_id", "vpc_endpoint_id", and "vpc_peering_connection_id" are required.
  1. Context: I'm trying to configure a route table for a VPC in AWS with an associated Internet Gateway. Here's the code for the aws_route_table resource in my Terraform file
"aws_route_table": {
   "public_rt": {
       "vpc_id": "${var.vpc_id}",
       "route": [
           {
               "cidr_block": "0.0.0.0/0",
               "gateway_id": "${aws_internet_gateway.main_igw.id}"
           }
       ],
       "tags": {
           "Name": "Public Route Table"
       },
       "depends_on": [
           "aws_internet_gateway.main_igw"
       ]
   }
}
  1. Additional Details:

I am defining an Internet Gateway separately in the same configuration. I get the error mentioned when trying to apply this code.

  1. Question:

What could be the cause of this error, and how can I fix the route configuration for AWS in this case? Should I add additional attributes to the route, or is it an issue related to the AWS provider version in Terraform?

Thanks for your help!

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论