Jaimin Patel
Jaimin Patel

Reputation: 1

Propogate tgw-attach from other account to local VPC : issue route propagation

I have multiple workload accounts. As new workloads come up I run terraform code to attach to TGW. Accept the TGW attachment request. Modify the routing table: Add workload to the default static route to inspection VPC. Also, associate tgw-attach to the route table.

But for propagation: I try to propagate the route to inspection VPC. I am getting the below error. In my TGW inspection route table, I already have ingress and egress VPC propagated. I am trying to add one more propagate workload env. to Inspection VPC propagation table.

Terraform Version

terraform --version
Terraform v1.8.0
on darwin_amd64`

Local File

locals {
  pending_acceptance_requests = {
    "tgw-attach-0xxxxxxxxxxxxxxx" = "dev-test"
    # Add more pending acceptance requests as needed
  }
}

Propagation code

resource "aws_ec2_transit_gateway_route_table_propagation" "propagate_routes" {
  for_each = local.pending_acceptance_requests

  transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.workload_route_table[each.key].id
  transit_gateway_attachment_id = aws_ec2_transit_gateway_route_table.tg_inspection_route_table.id
}

Here is Apply

Terraform will perform the following actions:

  # aws_ec2_transit_gateway_route_table_propagation.propagate_routes["tgw-attach-0xxxxxxxxxxxxx6"] will be created
  + resource "aws_ec2_transit_gateway_route_table_propagation" "propagate_routes" {
      + id                             = (known after apply)
      + resource_id                    = (known after apply)
      + resource_type                  = (known after apply)
      + transit_gateway_attachment_id  = "tgw-rtb-0xxxxxxxxxxxxa9"
      + transit_gateway_route_table_id = "tgw-rtb-0xxxxxxxxxxxxbe55"
    }

Error

│ Error: creating EC2 Transit Gateway Route Table Propagation (tgw-rtb-0daxxxxxxxxxxxxxx55_tgw-rtb-06b9xxxxxxxxxxxxa9): InvalidTransitGatewayAttachmentID.Malformed: Invalid Transit Gateway Attachment id tgw-rtb-0*a9. │ status code: 400, request id: 6526181d-f7c8-4fb2-804e-9888888888 │ │ with aws_ec2_transit_gateway_route_table_propagation.propagate_routes["tgw-attach-096"], │ on workload-tg.tf line 43, in resource "aws_ec2_transit_gateway_route_table_propagation" "propagate_routes": │ 43: resource "aws_ec2_transit_gateway_route_table_propagation" "propagate_routes" { │

Upvotes: 0

Views: 54

Answers (0)

Related Questions