-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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_vpn_gateway: Only validate Amazon-side ASN when creating new #5291
Conversation
aws/validators.go
Outdated
@@ -1733,20 +1733,20 @@ func validateStringIn(validValues ...string) schema.SchemaValidateFunc { | |||
} | |||
} | |||
|
|||
func validateAmazonSideAsn(v interface{}, k string) (ws []string, errors []error) { | |||
func validateAmazonSideAsn(v interface{}, k string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified signature so it can be called from CustomizeDiff
and ValidateFunc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This passes current acceptance testing but isn't able to be tested since the legacy ASNs cannot be created and imported. As noted in my concern below, I wonder if we should just allow the two ASNs with the previous validation function instead.
aws/resource_aws_vpn_gateway.go
Outdated
if diff.Id() == "" { | ||
// Only validate Amazon-side ASN for new resources. | ||
// Imported resources may have legacy 7224 or 9059 ASNs. | ||
if v, ok := diff.GetOk("amazon_side_asn"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding this correctly, this logic doesn't prevent the validation issue after creation where amazon_side_asn = 7224
is present in the configuration. Since it is technically valid, I think instead of adding all this workaround code that we should simply loosen our plan time validation to accept the two legacy values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can do that.
…ting new." This reverts commit cc3f031cdbf94e60ec6fb428e6e56e832e0e1b94.
Split Unit tests: $ go test -timeout 30s github.com/terraform-providers/terraform-provider-aws/aws -run ^TestValidateDxGatewayAmazonSideAsn$
ok github.com/terraform-providers/terraform-provider-aws/aws 0.009s
$ go test -timeout 30s github.com/terraform-providers/terraform-provider-aws/aws -run ^TestValidateVpnGatewayAmazonSideAsn$
ok github.com/terraform-providers/terraform-provider-aws/aws 0.009s Acceptance tests: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsDxGateway_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAwsDxGateway_basic -timeout 120m
=== RUN TestAccAwsDxGateway_basic
--- PASS: TestAccAwsDxGateway_basic (36.29s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 36.300s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSVpnGateway_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSVpnGateway_basic -timeout 120m
=== RUN TestAccAWSVpnGateway_basic
--- PASS: TestAccAWSVpnGateway_basic (70.92s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 70.940s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSVpnGateway_withAmazonSideAsnSetToState'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSVpnGateway_withAmazonSideAsnSetToState -timeout 120m
=== RUN TestAccAWSVpnGateway_withAmazonSideAsnSetToState
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (40.17s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 40.187s |
@bflad Ready to re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
11 tests passed (all tests)
=== RUN TestAccAwsDxGateway_basic
--- PASS: TestAccAwsDxGateway_basic (27.71s)
=== RUN TestAccAwsDxGateway_importBasic
--- PASS: TestAccAwsDxGateway_importBasic (28.49s)
=== RUN TestAccAWSVpnGateway_disappears
--- PASS: TestAccAWSVpnGateway_disappears (46.41s)
=== RUN TestAccAWSVpnGateway_withAmazonSideAsnSetToState
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (51.38s)
=== RUN TestAccAWSVpnGateway_delete
--- PASS: TestAccAWSVpnGateway_delete (59.33s)
=== RUN TestAccAWSVpnGateway_importBasic
--- PASS: TestAccAWSVpnGateway_importBasic (61.65s)
=== RUN TestAccAWSVpnGateway_withAvailabilityZoneSetToState
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (63.23s)
=== RUN TestAccAWSVpnGateway_tags
--- PASS: TestAccAWSVpnGateway_tags (67.79s)
=== RUN TestAccAWSVpnGateway_basic
--- PASS: TestAccAWSVpnGateway_basic (111.19s)
=== RUN TestAccAWSVpnGateway_reattach
--- PASS: TestAccAWSVpnGateway_reattach (126.28s)
=== RUN TestAccAwsDxGateway_importComplex
--- PASS: TestAccAwsDxGateway_importComplex (1023.41s)
This has been released in version 1.30.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Fixes #5263.
Unit tests:
Acceptance tests: