Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: incorrect duplicate route detection #36510

Closed
rus-geek opened this issue Mar 21, 2024 · 9 comments · Fixed by #36512
Closed

[Bug]: incorrect duplicate route detection #36510

rus-geek opened this issue Mar 21, 2024 · 9 comments · Fixed by #36512
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Milestone

Comments

@rus-geek
Copy link

rus-geek commented Mar 21, 2024

Terraform Core Version

1.3.3

AWS Provider Version

5.41.0

Affected Resource(s)

aws_route

Expected Behavior

Given a route table containing a propagated route to 0.0.0.0/0, I should be able to create a static route to 0.0.0.0/0 to override the propagated route.

Actual Behavior

terraform refuses to create the route, incorrectly indicating that it is a duplicate

Relevant Error/Panic Output Snippet

Error: RouteAlreadyExists: Route in Route Table (rtb-xxx) with destination (0.0.0.0/0) already exists

Terraform Configuration Files

resource "aws_route" "default_route" {
  route_table_id         = <your route table here>
  destination_cidr_block = "0.0.0.0/0"
  transit_gateway_id     = <your TGW here>
}

Steps to Reproduce

Create a VPC with a propagated route to 0.0.0.0/0 with any next hop.
Attempt to add a static route to 0.0.0.0/0 with any next hop.

Debug Output

No response

Panic Output

Error: RouteAlreadyExists: Route in Route Table (rtb-xxx) with destination (0.0.0.0/0) already exists

Important Factoids

No response

References

from the AWS documentation: "If the destination of a propagated route is identical to the destination of a static route, the static route takes priority..."

https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html#route-tables-priority

Would you like to implement a fix?

None

@rus-geek rus-geek added the bug Addresses a defect in current functionality. label Mar 21, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/vpc Issues and PRs that pertain to the vpc service. label Mar 21, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 21, 2024
@justinretzolk
Copy link
Member

Hey @rus-geek 👋 Thank you for taking the time to raise this! I can't quite tell from the log snippet provided, but this error looks to be coming from the AWS API itself. Are you able to provide debug logging (redacted as needed) and/or test from the AWS CLI to see if it behaves the same? That's often a decent indicator in situations like this.

@justinretzolk justinretzolk added the waiting-response Maintainers are waiting on response from community or contributor. label Mar 21, 2024
@rus-geek
Copy link
Author

rus-geek commented Mar 21, 2024

This works with prior versions of the provider, so it's allowed by AWS. The bug appears to have been introduced in this PR which "fixed" the creation of duplicate resources. #36326

We are able to create this route directly with AWS, and I am also able to create the route using 5.35.0 instead of 5.41.0

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 21, 2024
@rus-geek
Copy link
Author

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Mar 21, 2024
@ewbankkit
Copy link
Contributor

@rus-geek Thanks for raising this issue 👏.
I can reproduce this for the very similar case of the VPC-local route added via CreateRouteTable.
The fix is to check that the duplicate route was created via CreateRoute and only fail then.
I can get this fixed for today's Terraform AWS Provider v5.42.0 release.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.42.0 milestone Mar 21, 2024
Copy link

This functionality has been released in v5.42.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!

@rus-geek
Copy link
Author

Confirmed that this works as expected in 5.42.0. We are again able to create static routes that 'override' propagated routes.

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Projects
None yet
3 participants