hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.75k stars 9.11k forks source link

[Bug]: Missing Transit Gateway Attachments Attribute from Routes returned by aws_ec2_transit_gateway_route_table_routes #33535

Open bloudraak opened 1 year ago

bloudraak commented 1 year ago

Terraform Core Version

1.5.5

AWS Provider Version

5.16.2

Affected Resource(s)

Expected Behavior

Expected the routes returned by aws_ec2_transit_gateway_route_table_routes to return transit gateway attachments for the route (it is being returned by the underlying API)

Actual Behavior

It returns the destination_cidr_block, prefix_list_id, state, transit_gateway_route_table_announcement_id and type.

"routes" = tolist([
  {
    "destination_cidr_block" = "10.0.0.0/8"
    "prefix_list_id" = ""
    "state" = "blackhole"
    "transit_gateway_route_table_announcement_id" = ""
    "type" = "static"
  },
  {
    "destination_cidr_block" = "10.16.9.128/25"
    "prefix_list_id" = ""
    "state" = "active"
    "transit_gateway_route_table_announcement_id" = ""
    "type" = "static"
  },

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

N/A

Steps to Reproduce

data "aws_ec2_transit_gateway_route_tables" "us-east-1" {
  provider = aws.us-east-1
}

data "aws_ec2_transit_gateway_route_table" "us-east-1" {
  for_each = toset(data.aws_ec2_transit_gateway_route_tables.us-east-1.ids)
  id       = each.value
  provider = aws.us-east-1
}

data "aws_ec2_transit_gateway_route_table_routes" "us-east-1" {
  for_each                       =  toset(data.aws_ec2_transit_gateway_route_tables.us-east-1.ids) 
  filter {
    name   = "type"
    values = ["static"]
  }
  transit_gateway_route_table_id = each.value
  provider = aws.us-east-1
}

output "transit_gateway_routes" {
    value = data.aws_ec2_transit_gateway_route_table_routes.us-east-1
}

Debug Output

It doesn't crash

Panic Output

There's no panic

Important Factoids

Nothing special, just trying to get the a list of transit gateway routing tables, and their routes, so it can be fed into another system.

References

Seems the transitGatewayAttachments of the routes are not being returned. https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayRoute.html

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue