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_customer_gateway: Allow 4-byte ASNs #14030

Merged
merged 2 commits into from
Jul 2, 2020

Conversation

ewbankkit
Copy link
Contributor

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

Closes #14027.

Release note for CHANGELOG:

resource/aws_customer_gateway: Support 4-byte ASN values for `bgp_asn` attribute

Output from acceptance testing:

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

@ewbankkit ewbankkit requested a review from a team July 2, 2020 13:05
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jul 2, 2020
@bflad bflad added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. labels Jul 2, 2020
@bflad bflad added this to the v2.69.0 milestone Jul 2, 2020
@@ -30,7 +30,7 @@ func resourceAwsCustomerGateway() *schema.Resource {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
ValidateFunc: validation.IntBetween(1, 65534),
ValidateFunc: validation.IntBetween(0, 4294967295),
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately this is an esoteric problem that isn't caught by CI (#8988), but we'll need to do something different here to support 32-bit platforms:

$ gox -os='linux darwin windows freebsd openbsd solaris' -arch='386 amd64 arm' -osarch='!darwin/arm !darwin/386' -ldflags '-s -w -X aws/version.ProviderVersion=99.99.99 -X aws/version.ProtocolVersion=4' -output 'results/{{.OS}}_{{.Arch}}/terraform-provider-aws_v99.99.99_x4' .
Number of parallel builds: 15

-->   solaris/amd64: github.com/terraform-providers/terraform-provider-aws
-->       linux/arm: github.com/terraform-providers/terraform-provider-aws
-->     freebsd/arm: github.com/terraform-providers/terraform-provider-aws
-->     freebsd/386: github.com/terraform-providers/terraform-provider-aws
-->     openbsd/386: github.com/terraform-providers/terraform-provider-aws
-->       linux/386: github.com/terraform-providers/terraform-provider-aws
-->     linux/amd64: github.com/terraform-providers/terraform-provider-aws
-->   windows/amd64: github.com/terraform-providers/terraform-provider-aws
-->    darwin/amd64: github.com/terraform-providers/terraform-provider-aws
-->   openbsd/amd64: github.com/terraform-providers/terraform-provider-aws
-->     windows/386: github.com/terraform-providers/terraform-provider-aws
-->   freebsd/amd64: github.com/terraform-providers/terraform-provider-aws

6 errors occurred:
--> openbsd/386 error: exit status 2
Stderr: # github.com/terraform-providers/terraform-provider-aws/aws
aws/resource_aws_customer_gateway.go:33:44: constant 4294967295 overflows int

--> freebsd/arm error: exit status 2
Stderr: # github.com/terraform-providers/terraform-provider-aws/aws
aws/resource_aws_customer_gateway.go:33:44: constant 4294967295 overflows int

--> linux/386 error: exit status 2
Stderr: # github.com/terraform-providers/terraform-provider-aws/aws
aws/resource_aws_customer_gateway.go:33:44: constant 4294967295 overflows int

--> linux/arm error: exit status 2
Stderr: # github.com/terraform-providers/terraform-provider-aws/aws
aws/resource_aws_customer_gateway.go:33:44: constant 4294967295 overflows int

--> windows/386 error: exit status 2
Stderr: # github.com/terraform-providers/terraform-provider-aws/aws
aws/resource_aws_customer_gateway.go:33:44: constant 4294967295 overflows int

--> freebsd/386 error: exit status 2
Stderr: # github.com/terraform-providers/terraform-provider-aws/aws
aws/resource_aws_customer_gateway.go:33:44: constant 4294967295 overflows int

You can check it much quicker without gox via:

$ GOOS=linux GOARCH=386 go build
# github.com/terraform-providers/terraform-provider-aws/aws
aws/resource_aws_customer_gateway.go:33:44: constant 4294967295 overflows int

We can see how long the cross-compilation testing takes in GitHub Actions, although that was the original blocker for implementing it in TravisCI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aah yes, this is similar to #1888.
Is changing the attribute from TypeInt to TypeString a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In practice it seems not to be.

@bflad bflad mentioned this pull request Jul 2, 2020
4 tasks
@ghost ghost added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Jul 2, 2020
@ewbankkit
Copy link
Contributor Author

ewbankkit commented Jul 2, 2020

Changed bgp_asn to TypeString and added validator.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSCustomerGateway_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSCustomerGateway_ -timeout 120m
=== RUN   TestAccAWSCustomerGateway_basic
=== PAUSE TestAccAWSCustomerGateway_basic
=== RUN   TestAccAWSCustomerGateway_tags
=== PAUSE TestAccAWSCustomerGateway_tags
=== RUN   TestAccAWSCustomerGateway_similarAlreadyExists
=== PAUSE TestAccAWSCustomerGateway_similarAlreadyExists
=== RUN   TestAccAWSCustomerGateway_disappears
=== PAUSE TestAccAWSCustomerGateway_disappears
=== RUN   TestAccAWSCustomerGateway_4ByteAsn
=== PAUSE TestAccAWSCustomerGateway_4ByteAsn
=== CONT  TestAccAWSCustomerGateway_basic
=== CONT  TestAccAWSCustomerGateway_disappears
=== CONT  TestAccAWSCustomerGateway_similarAlreadyExists
=== CONT  TestAccAWSCustomerGateway_tags
=== CONT  TestAccAWSCustomerGateway_4ByteAsn
--- PASS: TestAccAWSCustomerGateway_disappears (29.92s)
--- PASS: TestAccAWSCustomerGateway_4ByteAsn (35.95s)
--- PASS: TestAccAWSCustomerGateway_similarAlreadyExists (43.40s)
--- PASS: TestAccAWSCustomerGateway_basic (63.07s)
--- PASS: TestAccAWSCustomerGateway_tags (66.39s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	66.472s

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Output from acceptance testing:

--- PASS: TestAccAWSCustomerGateway_disappears (18.14s)
--- PASS: TestAccAWSCustomerGateway_4ByteAsn (20.38s)
--- PASS: TestAccAWSCustomerGateway_similarAlreadyExists (23.01s)
--- PASS: TestAccAWSCustomerGateway_basic (36.37s)
--- PASS: TestAccAWSCustomerGateway_tags (62.25s)

@bflad bflad merged commit bb489e7 into hashicorp:master Jul 2, 2020
bflad added a commit that referenced this pull request Jul 2, 2020
@ewbankkit ewbankkit deleted the b-aws_customer_gateway-4-byte-asn branch July 2, 2020 20:27
@ghost
Copy link

ghost commented Jul 3, 2020

This has been released in version 2.69.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 Aug 2, 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 and limited conversation to collaborators Aug 2, 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. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. 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.

New bgp_asn plan validation in aws_customer_gateway resources prevents use of 4-byte values
2 participants