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

aws_ec2_transit_gateway_route: cidr match is unreliable #14846

Conversation

thekev
Copy link
Contributor

@thekev thekev commented Aug 25, 2020

  • aws api returns expanded prefix, but hcl may contain compressed prefix
  • use cidrBlocksEqual() instead of string comparison to find route
  • normalize route destination value to RFC1924 compressed

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #14845

Release note for CHANGELOG:

Improve reliability of route matching for transit gateway routes.

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSEc2TransitGatewayRoute_basic_ipv6' ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 3 -run=TestAccAWSEc2TransitGatewayRoute_basic_ipv6 -timeout 120m
=== RUN   TestAccAWSEc2TransitGatewayRoute_basic_ipv6
=== PAUSE TestAccAWSEc2TransitGatewayRoute_basic_ipv6
=== CONT  TestAccAWSEc2TransitGatewayRoute_basic_ipv6
--- PASS: TestAccAWSEc2TransitGatewayRoute_basic_ipv6 (327.71s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	329.745s
$ make testacc TESTARGS='-run=Test_canonicalCidrBlock' ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 3 -run=Test_canonicalCidrBlock -timeout 120m
=== RUN   Test_canonicalCidrBlock
--- PASS: Test_canonicalCidrBlock (0.00s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1.823s

* aws api returns expanded prefix, but hcl may contain compressed prefix
* use cidrBlocksEqual() instead of string comparison to find route
* normalize route destination value to RFC1924 compressed
@thekev thekev requested a review from a team August 25, 2020 22:45
@ghost ghost added size/S Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. labels Aug 25, 2020
@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Aug 26, 2020
@thekev thekev changed the title aws_ec2_transit_gateway_route: ipv6 support aws_ec2_transit_gateway_route: cidr match is unreliable Aug 26, 2020
@ewbankkit
Copy link
Contributor

Verified acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSEc2TransitGatewayRoute_basic_ipv6'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSEc2TransitGatewayRoute_basic_ipv6 -timeout 120m
=== RUN   TestAccAWSEc2TransitGatewayRoute_basic_ipv6
=== PAUSE TestAccAWSEc2TransitGatewayRoute_basic_ipv6
=== CONT  TestAccAWSEc2TransitGatewayRoute_basic_ipv6
--- PASS: TestAccAWSEc2TransitGatewayRoute_basic_ipv6 (306.79s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	306.826s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSEc2TransitGatewayRoute_basic$$'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSEc2TransitGatewayRoute_basic$ -timeout 120m
=== RUN   TestAccAWSEc2TransitGatewayRoute_basic
=== PAUSE TestAccAWSEc2TransitGatewayRoute_basic
=== CONT  TestAccAWSEc2TransitGatewayRoute_basic
--- PASS: TestAccAWSEc2TransitGatewayRoute_basic (304.09s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	304.134s

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

Looks good apart from minor suggested change.

aws/ec2_transit_gateway.go Outdated Show resolved Hide resolved
Co-authored-by: Kit Ewbank <Kit_Ewbank@hotmail.com>
Copy link
Contributor

@ewbankkit ewbankkit 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 TEST=./aws/ TESTARGS='-run=TestAccAWSEc2TransitGatewayRoute_basic_ipv6'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSEc2TransitGatewayRoute_basic_ipv6 -timeout 120m
=== RUN   TestAccAWSEc2TransitGatewayRoute_basic_ipv6
=== PAUSE TestAccAWSEc2TransitGatewayRoute_basic_ipv6
=== CONT  TestAccAWSEc2TransitGatewayRoute_basic_ipv6
--- PASS: TestAccAWSEc2TransitGatewayRoute_basic_ipv6 (393.42s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	393.464s

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Aug 28, 2020
@DrFaust92 DrFaust92 added the bug Addresses a defect in current functionality. label Aug 28, 2020
Copy link
Collaborator

@DrFaust92 DrFaust92 left a comment

Choose a reason for hiding this comment

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

LGTM

--- PASS: TestAccAWSEc2TransitGatewayRoute_basic_ipv6 (382.25s)

@gdavison gdavison self-assigned this Oct 8, 2020
They were causing the full set of acceptance tests to run if `validators_test.go` is modified
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

--- PASS: TestCanonicalCidrBlock (0.00s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTable_disappears_TransitGateway (254.06s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTable_disappears (308.93s)
--- PASS: TestAccAWSEc2TransitGatewayRoute_disappears (369.18s)
--- PASS: TestAccAWSEc2TransitGatewayRoute_disappears_TransitGatewayAttachment (371.33s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTable_basic (372.06s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTableDataSource_ID (371.42s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTablePropagation_basic (372.35s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTableDataSource_Filter (372.46s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTable_Tags (372.87s)
--- PASS: TestAccAWSEc2TransitGatewayRoute_basic (431.73s)
--- PASS: TestAccAWSEc2TransitGatewayRoute_blackhole (431.61s)
--- PASS: TestAccAWSEc2TransitGatewayRoute_basic_ipv6 (433.33s)
--- PASS: TestAccAWSEc2TransitGatewayRouteTableAssociation_basic (492.15s)

@gdavison gdavison added this to the v3.11.0 milestone Oct 9, 2020
@gdavison gdavison merged commit c73af7d into hashicorp:master Oct 9, 2020
gdavison added a commit that referenced this pull request Oct 9, 2020
@ghost
Copy link

ghost commented Oct 15, 2020

This has been released in version 3.11.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 for triage. Thanks!

@ghost
Copy link

ghost commented Nov 9, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Nov 9, 2020
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. documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. size/M 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.

aws_ec2_transit_gateway_route does not properly compare compressed/expanded ipv6 prefixes
5 participants