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

r/aws_route: Don't fail on Create if there's already a propagated (or local) route to the same destination #36512

Merged
merged 7 commits into from Mar 21, 2024

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Mar 21, 2024

Description

Allow creation of a route if there's already a VGW propagated route (or VPC-local) route to the same destination.

Relations

Closes #36510.
Relates #36326.

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccVPCRoute_localRoute\|TestAccVPCRoute_basic\|TestAccVPCRoute_duplicate' PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPCRoute_localRoute\|TestAccVPCRoute_basic\|TestAccVPCRoute_duplicate -timeout 360m
=== RUN   TestAccVPCRoute_basic
=== PAUSE TestAccVPCRoute_basic
=== RUN   TestAccVPCRoute_localRouteCreateError
=== PAUSE TestAccVPCRoute_localRouteCreateError
=== RUN   TestAccVPCRoute_localRouteImport
=== PAUSE TestAccVPCRoute_localRouteImport
=== RUN   TestAccVPCRoute_localRouteImportAndUpdate
=== PAUSE TestAccVPCRoute_localRouteImportAndUpdate
=== RUN   TestAccVPCRoute_duplicate
=== PAUSE TestAccVPCRoute_duplicate
=== CONT  TestAccVPCRoute_basic
=== CONT  TestAccVPCRoute_localRouteImportAndUpdate
=== CONT  TestAccVPCRoute_duplicate
=== CONT  TestAccVPCRoute_localRouteImport
=== CONT  TestAccVPCRoute_localRouteCreateError
--- PASS: TestAccVPCRoute_duplicate (20.92s)
--- PASS: TestAccVPCRoute_localRouteImport (35.34s)
--- PASS: TestAccVPCRoute_basic (36.43s)
--- PASS: TestAccVPCRoute_localRouteCreateError (38.52s)
--- PASS: TestAccVPCRoute_localRouteImportAndUpdate (68.24s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	80.587s

Without the fix:

% make testacc TESTARGS='-run=TestAccVPCRoute_localRouteCreateError' PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPCRoute_localRouteError -timeout 360m
=== RUN   TestAccVPCRoute_localRouteCreateError
=== PAUSE TestAccVPCRoute_localRouteCreateError
=== CONT  TestAccVPCRoute_localRouteCreateError
    vpc_route_test.go:1687: Step 2/2, expected an error with pattern, no match on: Error running apply: exit status 1
        
        Error: RouteAlreadyExists: Route in Route Table (rtb-05af6f646b345080f) with destination (10.1.0.0/16) already exists
        
          with aws_route.test,
          on terraform_plugin_test.tf line 28, in resource "aws_route" "test":
          28: resource "aws_route" "test" {
        
--- FAIL: TestAccVPCRoute_localRouteCreateError (28.74s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	40.395s
FAIL
make: *** [testacc] Error 1

% make testacc TESTARGS='-run=TestAccVPCRoute_localRouteError' PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPCRoute_localRouteError -timeout 360m
=== RUN   TestAccVPCRoute_localRouteError
=== PAUSE TestAccVPCRoute_localRouteError
=== CONT  TestAccVPCRoute_localRouteError
    vpc_route_test.go:1687: Step 2/2, expected an error with pattern, no match on: Error running apply: exit status 1

        Error: RouteAlreadyExists: Route in Route Table (rtb-05af6f646b345080f) with destination (10.1.0.0/16) already exists

          with aws_route.test,
          on terraform_plugin_test.tf line 28, in resource "aws_route" "test":
          28: resource "aws_route" "test" {

--- FAIL: TestAccVPCRoute_localRouteError (28.74s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	40.395s
FAIL
make: *** [testacc] Error 1
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/vpc Issues and PRs that pertain to the vpc service. labels Mar 21, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Mar 21, 2024
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Mar 21, 2024
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

% make testacc TESTARGS='-run=TestAccVPCRoute_localRoute\|TestAccVPCRoute_basic\|TestAccVPCRoute_duplicate' PKG=ec2

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPCRoute_localRoute\|TestAccVPCRoute_basic\|TestAccVPCRoute_duplicate -timeout 360m
=== RUN   TestAccVPCRoute_basic
=== PAUSE TestAccVPCRoute_basic
=== RUN   TestAccVPCRoute_localRouteCreateError
=== PAUSE TestAccVPCRoute_localRouteCreateError
=== RUN   TestAccVPCRoute_localRouteImport
=== PAUSE TestAccVPCRoute_localRouteImport
=== RUN   TestAccVPCRoute_localRouteImportAndUpdate
=== PAUSE TestAccVPCRoute_localRouteImportAndUpdate
=== RUN   TestAccVPCRoute_duplicate
=== PAUSE TestAccVPCRoute_duplicate
=== CONT  TestAccVPCRoute_basic
=== CONT  TestAccVPCRoute_localRouteImportAndUpdate
=== CONT  TestAccVPCRoute_localRouteImport
=== CONT  TestAccVPCRoute_duplicate
=== CONT  TestAccVPCRoute_localRouteCreateError
--- PASS: TestAccVPCRoute_duplicate (16.17s)
--- PASS: TestAccVPCRoute_localRouteImport (26.87s)
--- PASS: TestAccVPCRoute_basic (27.38s)
--- PASS: TestAccVPCRoute_localRouteCreateError (29.35s)
--- PASS: TestAccVPCRoute_localRouteImportAndUpdate (55.34s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	57.809s

@ewbankkit ewbankkit merged commit fb68fa7 into main Mar 21, 2024
56 checks passed
@ewbankkit ewbankkit deleted the b-aws_route-duplicate-route-propagation branch March 21, 2024 19:58
@github-actions github-actions bot added this to the v5.42.0 milestone Mar 21, 2024
github-actions bot pushed a commit that referenced this pull request 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!

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Mar 22, 2024
Copy link

I'm going to lock this pull request 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 related to this change, 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 22, 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. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: incorrect duplicate route detection
2 participants