0

I just want to confirm my understanding of something I found in the Terraform-AWS-VPC module.

Outside of Terraform, a network engineer added a transit gateway to our AWS account. If I run terraform apply, will I lose his transit gateway and cidr block additions, or is the terraform plan output (below) simply telling me that Terraform has found the values of the transit_gateway_id and cidr_block? I looked at the source code for the VPC module and it appears on line 154 that the code is looking up the values for the transit_gateway_id and cidr_block fields.

terraform plan

# module.vpc.aws_route_table.private[0] has changed
  ~ resource "aws_route_table" "private" {
        id               = "rtb-12345"
      ~ route            = [
          + {
              + carrier_gateway_id         = ""
              + cidr_block                 = "10.0.0.0/8"
              + destination_prefix_list_id = ""
              + egress_only_gateway_id     = ""
              + gateway_id                 = ""
              + instance_id                = ""
              + ipv6_cidr_block            = ""
              + local_gateway_id           = ""
              + nat_gateway_id             = ""
              + network_interface_id       = ""
              + transit_gateway_id         = "tgw-12345"
              + vpc_endpoint_id            = ""
              + vpc_peering_connection_id  = ""
            },
          + {
              + carrier_gateway_id         = ""
              + cidr_block                 = "172.0.0.0/32"
              + destination_prefix_list_id = ""
              + egress_only_gateway_id     = ""
              + gateway_id                 = ""
              + instance_id                = ""
              + ipv6_cidr_block            = ""
              + local_gateway_id           = ""
              + nat_gateway_id             = ""
              + network_interface_id       = ""
              + transit_gateway_id         = "tgw-12345"
              + vpc_endpoint_id            = ""
              + vpc_peering_connection_id  = ""
            },
            # (1 unchanged element hidden)
        ]
        tags             = {
            "Terraform_Managed" = "True"
        }
        # (5 unchanged attributes hidden)
    }

Thanks

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Gooby
  • 1
  • Well, the output says the route table will be changed in-place (noted by `~`) and the `+` sign shows what will be added. – Marko E Mar 21 '22 at 16:33
  • I'm thinking this won't be a detrimental change that blows away his transit gateway config. Thanks for responding Marko E. – Gooby Mar 21 '22 at 17:08
  • The output will add two routes to your existing routing table rtb-12345.One for 10.0.0.0/8 and one for 172.0.0.0/32. All traffic of the subnets, which are attached to the routing table, will routed to the tgw tgw-12345. – Daniel Seichter Mar 21 '22 at 20:01
  • What is your actual TF code? – Marcin Mar 22 '22 at 00:27

0 Answers0