Closed deutmeyerbrianpfg closed 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
This functionality has been released in v5.20.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Terraform Core Version
1.5.0
AWS Provider Version
5.5.0, 5.19.0
Affected Resource(s)
aws_ec2_transit_gateway_route
Expected Behavior
When running a plan for apply, the route should be found and no change should occur.
Actual Behavior
Routes are being returned in numerical order and anthing after route #1000 won't be returned. Terraform will say the route no longer exists and will try to recreate it. The results in a error because the route does actually exist. Any route that falls under the first 1,000 results works just fine.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
resource "aws_ec2_transit_gateway_route" "this" { destination_cidr_block = "172.16.20.0/23 transit_gateway_attachment_id = "tgw-attach-69280a1420191xxxx" transit_gateway_route_table_id = "tgw-rtb-420929cc306c0xxxx" }
Steps to Reproduce
Make sure there are 1000 routes from the 10.0.0.0/8 network to ensure the 172.16.0.0/12 space gets returned last.
Debug Output
2023-10-04T18:48:05.481Z [WARN] provider.terraform-provider-aws_v5.5.0_x5: [WARN] EC2 Transit Gateway Route tgw-rtb-420929cc306c0xxxx_172.16.20.0/23 not found, removing from state 2023-10-04T18:48:05.482Z [WARN] Provider "registry.terraform.io/hashicorp/aws" produced an unexpected new value for aws_ec2_transit_gateway_route.this during refresh.
Panic Output
No response
Important Factoids
No response
References
I think this is the lookup on refresh: https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/ec2/transitgateway_route.go#L105
It only passing in the destination and the TGW route table ID. The API is only returning 1,000 repsonses. This should be updated so it can also be passed the attachment ID (if applicable) and blackhole status. Then the lookup can determine which additional filter to apply. https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/ec2/find.go#L4600
Max Results listed here: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SearchTransitGatewayRoutes.html
Would you like to implement a fix?
None