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

Final retries deleting and attaching VPN gateways #9641

Merged
merged 3 commits into from
Aug 9, 2019
Merged

Conversation

ryndaniels
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" comments, they generate extra noise for pull request followers and do not help prioritize the request

Relates #7873

Release note for CHANGELOG:

BUG FIXES
* resource/aws_vpn_gateway: Retry after timeouts attaching and deleting VPN gateways, and retrying attachment after pending VPN errors

Output from acceptance testing:

$ make testacc TESTARGS="-run=TestAccAWSVpnGateway"         
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSVpnGateway -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSVpnGatewayAttachment_basic
=== PAUSE TestAccAWSVpnGatewayAttachment_basic
=== RUN   TestAccAWSVpnGatewayAttachment_deleted
=== PAUSE TestAccAWSVpnGatewayAttachment_deleted
=== RUN   TestAccAWSVpnGateway_importBasic
=== PAUSE TestAccAWSVpnGateway_importBasic
=== RUN   TestAccAWSVpnGateway_basic
=== PAUSE TestAccAWSVpnGateway_basic
=== RUN   TestAccAWSVpnGateway_withAvailabilityZoneSetToState
=== PAUSE TestAccAWSVpnGateway_withAvailabilityZoneSetToState
=== RUN   TestAccAWSVpnGateway_withAmazonSideAsnSetToState
=== PAUSE TestAccAWSVpnGateway_withAmazonSideAsnSetToState
=== RUN   TestAccAWSVpnGateway_disappears
=== PAUSE TestAccAWSVpnGateway_disappears
=== RUN   TestAccAWSVpnGateway_reattach
=== PAUSE TestAccAWSVpnGateway_reattach
=== RUN   TestAccAWSVpnGateway_delete
=== PAUSE TestAccAWSVpnGateway_delete
=== RUN   TestAccAWSVpnGateway_tags
=== PAUSE TestAccAWSVpnGateway_tags
=== CONT  TestAccAWSVpnGatewayAttachment_basic
=== CONT  TestAccAWSVpnGateway_withAmazonSideAsnSetToState
=== CONT  TestAccAWSVpnGateway_disappears
=== CONT  TestAccAWSVpnGateway_basic
=== CONT  TestAccAWSVpnGateway_importBasic
=== CONT  TestAccAWSVpnGateway_withAvailabilityZoneSetToState
=== CONT  TestAccAWSVpnGateway_delete
=== CONT  TestAccAWSVpnGatewayAttachment_deleted
=== CONT  TestAccAWSVpnGateway_tags
=== CONT  TestAccAWSVpnGateway_reattach
--- PASS: TestAccAWSVpnGatewayAttachment_basic (90.48s)
--- PASS: TestAccAWSVpnGateway_disappears (103.10s)
--- PASS: TestAccAWSVpnGateway_importBasic (117.63s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (120.07s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (129.88s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (138.66s)
--- PASS: TestAccAWSVpnGateway_delete (151.66s)
--- PASS: TestAccAWSVpnGateway_tags (156.99s)
--- PASS: TestAccAWSVpnGateway_basic (165.93s)
--- PASS: TestAccAWSVpnGateway_reattach (239.61s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       240.459s

@ryndaniels ryndaniels requested a review from a team August 6, 2019 12:55
@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. labels Aug 6, 2019
@ryndaniels ryndaniels added the bug Addresses a defect in current functionality. label Aug 6, 2019
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.

Looking good, just two notes to address below.

--- PASS: TestAccAWSVpnGateway_delete (50.49s)
--- PASS: TestAccAWSVpnGateway_disappears (54.67s)
--- PASS: TestAccAWSVpnGatewayAttachment_basic (56.22s)
--- PASS: TestAccAWSVpnGateway_tags (58.54s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (61.84s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (69.88s)
--- PASS: TestAccAWSVpnGateway_importBasic (76.91s)
--- PASS: TestAccAWSVpnGateway_basic (86.56s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (92.27s)
--- PASS: TestAccAWSVpnGateway_reattach (141.39s)

case "InvalidVpnGatewayID.NotFound":
return nil
case "IncorrectState":
if !isAWSErr(err, "", "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a valid error condition to test 😉 All AWS Go SDK errors should have an error code. We can just remove this if condition here.

@@ -206,13 +215,19 @@ func resourceAwsVpnGatewayAttach(d *schema.ResourceData, meta interface{}) error
if isAWSErr(err, "InvalidVpnGatewayID.NotFound", "") {
return resource.RetryableError(err)
}
if isAWSErr(err, "InvalidParameterValue", "This call cannot be completed because there are pending VPNs or Virtual Interfaces") {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest moving this logic into aws/config.go so we can have the AWS Go SDK automatically retry this API call anywhere its used. See also: https://github.com/terraform-providers/terraform-provider-aws/blob/7cb3734472b25b4515367d55326b88ae480c5937/aws/config.go#L556-L574

@bflad bflad assigned ryndaniels and unassigned bflad Aug 6, 2019
@ghost ghost added the provider Pertains to the provider itself, rather than any interaction with AWS. label Aug 8, 2019
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

--- PASS: TestAccAWSVpnGateway_disappears (46.04s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (46.43s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (52.47s)
--- PASS: TestAccAWSVpnGateway_importBasic (55.84s)
--- PASS: TestAccAWSVpnGatewayAttachment_basic (56.12s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (61.87s)
--- PASS: TestAccAWSVpnGateway_tags (62.66s)
--- PASS: TestAccAWSVpnGateway_delete (98.15s)
--- PASS: TestAccAWSVpnGateway_basic (114.31s)
--- PASS: TestAccAWSVpnGateway_reattach (134.79s)

@ryndaniels ryndaniels merged commit 0fae745 into master Aug 9, 2019
@ryndaniels ryndaniels added this to the v2.24.0 milestone Aug 9, 2019
@ghost
Copy link

ghost commented Aug 15, 2019

This has been released in version 2.24.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!

@ryndaniels ryndaniels deleted the rfd-retry-vpn branch August 16, 2019 07:38
@ghost
Copy link

ghost commented Nov 1, 2019

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 Nov 1, 2019
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. provider Pertains to the provider itself, rather than any interaction with AWS. service/ec2 Issues and PRs that pertain to the ec2 service. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants