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

Add support for Amazon side private ASN for aws_vpn_gateway #1888

Merged
merged 4 commits into from
Feb 8, 2018

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Oct 13, 2017

Fixes #1859
Acceptance tests:

Running tool: /usr/local/go/bin/go test -timeout 30s github.com/terraform-providers/terraform-provider-aws/aws -run ^TestValidateAmazonSideAsn$

ok  	github.com/terraform-providers/terraform-provider-aws/aws	0.014s
Success: Tests passed.
make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSVpnGateway_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSVpnGateway_ -timeout 120m
=== RUN   TestAccAWSVpnGateway_importBasic
--- PASS: TestAccAWSVpnGateway_importBasic (43.61s)
=== RUN   TestAccAWSVpnGateway_basic
--- PASS: TestAccAWSVpnGateway_basic (77.10s)
=== RUN   TestAccAWSVpnGateway_withAvailabilityZoneSetToState
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (38.76s)
=== RUN   TestAccAWSVpnGateway_withAmazonSideAsnSetToState
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (47.32s)
=== RUN   TestAccAWSVpnGateway_disappears
--- PASS: TestAccAWSVpnGateway_disappears (36.77s)
=== RUN   TestAccAWSVpnGateway_reattach
--- PASS: TestAccAWSVpnGateway_reattach (101.08s)
=== RUN   TestAccAWSVpnGateway_delete
--- PASS: TestAccAWSVpnGateway_delete (52.53s)
=== RUN   TestAccAWSVpnGateway_tags
--- PASS: TestAccAWSVpnGateway_tags (64.17s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	461.351s
make testacc TEST=./aws/ TESTARGS='-run=TestAccDataSourceAwsVpnGateway_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccDataSourceAwsVpnGateway_ -timeout 120m
=== RUN   TestAccDataSourceAwsVpnGateway_unattached
--- PASS: TestAccDataSourceAwsVpnGateway_unattached (18.27s)
=== RUN   TestAccDataSourceAwsVpnGateway_attached
--- PASS: TestAccDataSourceAwsVpnGateway_attached (52.50s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	70.778s

@ewbankkit
Copy link
Contributor Author

amazon_side_asn is defined as schema.TypeString as schema.TypeInt doesn't handle 64-bit integers.

@radeksimko radeksimko added the enhancement Requests to existing resources that expand the functionality or scope. label Oct 14, 2017
@radeksimko
Copy link
Member

Hi @ewbankkit
thanks for the PR.

amazon_side_asn is defined as schema.TypeString as schema.TypeInt doesn't handle 64-bit integers.

can you be more specific? The schema should support int64 just fine and I don't remember we'd ever need to use TypeString for integers for any such reason.

@radeksimko radeksimko added the waiting-response Maintainers are waiting on response from community or contributor. label Oct 27, 2017
@ewbankkit
Copy link
Contributor Author

@radeksimko According to the comment here TypeInt is equivalent to golang int which is a 32-bit integer and code like this looks like it would break if a value > 2147483647 (which these ASNs can be) was stored in the field.
Agreed that my implementation seems hacky.

@ewbankkit
Copy link
Contributor Author

Cleaner would be to add TypeInt64 to valuetype.go.

@radeksimko radeksimko removed the waiting-response Maintainers are waiting on response from community or contributor. label Oct 29, 2017
@radeksimko
Copy link
Member

is equivalent to golang int which is a 32-bit integer

That depends purely on the architecture of the binary you build, I think. It will be int64 on 64bit. That said we do release four 32bit packages of Terraform https://www.terraform.io/downloads.html

This may in fact be causing issues elsewhere... and if it is, we do need to come up with more reasonable solution.

@radeksimko radeksimko added the upstream-terraform Addresses functionality related to the Terraform core binary. label Oct 29, 2017
@edmundcraske
Copy link
Contributor

I thought that ASNs are 32 bits at most (with most common ones being 16 bit)? https://en.wikipedia.org/wiki/Autonomous_system_%28Internet%29 seems to agree with me, and links to https://tools.ietf.org/html/rfc6793.

@ewbankkit
Copy link
Contributor Author

I think the problem is that int is a signed integer and on 32-bit systems can only represent values up to 2147483647. 32-bit ASNs need to be between 4200000000 and 4294967294.

@radeksimko radeksimko added the size/L Managed by automation to categorize the size of a PR. label Nov 15, 2017
@jonstacks
Copy link

Is there any update on this? We would really love this feature to get merged soon so that we can use terraform to manage our transit-vpc setup across regions. If there is anything that can be done to help out, let me know.

@ewbankkit
Copy link
Contributor Author

@jonstacks The correct implementation of this (typeof(amazon_side_asn) != string) requires changes to upstream Terraform core to support either 64-bit or "big" integers. Not sure when that will be available.

@jonstacks
Copy link

@ewbankkit,

Thanks for the update on this. I'd assume there is already a branch of terraform core that supports int64 or big.Int. I'll try building core against that branch and try running the code from this branch against it.

@ewbankkit
Copy link
Contributor Author

Opened https://github.com/hashicorp/terraform/issues/17077 for the 64-bit/big int support in Terraform.

@ewbankkit ewbankkit force-pushed the issue-1859 branch 2 times, most recently from 973fe22 to 2242942 Compare January 10, 2018 20:12
@ewbankkit
Copy link
Contributor Author

The guidance from @apparentlymart in https://github.com/hashicorp/terraform/issues/17077 for now is to use TypeString for attributes that require 64-bit (or larger) integers.

@pmoust
Copy link
Contributor

pmoust commented Jan 11, 2018

@apparentlymart ASN's are 4-Byte max atm, unless something drastically changes in the RFC/RIPE/ARIN there is no reason to worry on that.
On the topic of signed integers, 32bit etc. Can we just accept the situation for now and go with TypeString as suggested?

We would love to see this in.

@bflad bflad added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 28, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Feb 8, 2018
@radeksimko radeksimko merged commit 41b957f into hashicorp:master Feb 8, 2018
@radeksimko
Copy link
Member

@ewbankkit Thanks for the wait and opening upstream issue.

@pmoust
Copy link
Contributor

pmoust commented Feb 8, 2018

Thanks @ewbankkit for tackling it and thanks @radeksimko for accepting the interim solution.

@ewbankkit ewbankkit deleted the issue-1859 branch February 8, 2018 23:05
@radeksimko radeksimko added this to the v1.9.0 milestone Feb 9, 2018
@bflad
Copy link
Contributor

bflad commented Feb 9, 2018

This has been released in terraform-provider-aws version 1.9.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 8, 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 Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. size/L Managed by automation to categorize the size of a PR. upstream-terraform Addresses functionality related to the Terraform core binary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Amazon side private ASN for aws_vpn_gateway
6 participants