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

service/ec2: Automatically retry on DetachVpnGateway calls receiving InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces #11720

Merged
merged 1 commit into from
Mar 10, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jan 22, 2020

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

Release note for CHANGELOG:

* resource/aws_vpn_gateway: Automatically retry on `DetachVpnGateway` calls receiving `InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces`
* resource/aws_vpn_gateway_attachment: Automatically retry on `DetachVpnGateway` calls receiving `InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces`

Previously in the acceptance testing (inconsistently):

--- FAIL: TestAccAwsDxGateway_complex (1395.94s)
    testing.go:696: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: Error detaching VPN Gateway "vgw-0cdff63748b555ce1" from VPC "vpc-03b0d4f907a594a7e": InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces

--- FAIL: TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount (753.92s)
    testing.go:696: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: Error detaching VPN Gateway "vgw-0347d6f94f7b41c56" from VPC "vpc-09e6a66d7f16b1df8": InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces

--- FAIL: TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount (1394.16s)
    testing.go:701: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: Error detaching VPN Gateway "vgw-0ff7518e32f5e9a41" from VPC "vpc-00285431f07f5bc9d": InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces

Example debug logging:

2019/12/18 06:09:29 [DEBUG] [aws-sdk-go] DEBUG: Response ec2/DetachVpnGateway Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Transfer-Encoding: chunked
Date: Wed, 18 Dec 2019 06:09:29 GMT
Server: AmazonEC2

-----------------------------------------------------
2019/12/18 06:09:29 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidParameterValue</Code><Message>This call cannot be completed because there are pending VPNs or Virtual Interfaces</Message></Error></Errors><RequestID>f951ecbf-328e-4fe3-be78-f02e8902da90</RequestID></Response>
2019/12/18 06:09:29 [DEBUG] [aws-sdk-go] DEBUG: Validate Response ec2/DetachVpnGateway failed, attempt 0/25, error InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces
  status code: 400, request id: f951ecbf-328e-4fe3-be78-f02e8902da90

Here we allow the retryable logic that applies to the AttachVpnGateway call to also apply to the DetachVpnGateway call.

Output from acceptance testing:

--- PASS: TestAccAwsDxGateway_basic (75.94s)
--- PASS: TestAccAwsDxGateway_complex (1442.22s)

--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount (1741.64s)
--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount (1561.21s)
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount (1067.31s)
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount (1064.09s)
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount (1135.38s)
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount (1164.79s)
--- PASS: TestAccAwsDxGatewayAssociation_deprecatedSingleAccount (1450.04s)
--- PASS: TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount (1160.43s)

--- PASS: TestAccAWSVpnGateway_basic (97.92s)
--- PASS: TestAccAWSVpnGateway_delete (67.50s)
--- PASS: TestAccAWSVpnGateway_disappears (56.04s)
--- PASS: TestAccAWSVpnGateway_reattach (128.44s)
--- PASS: TestAccAWSVpnGateway_tags (68.82s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (51.51s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (48.04s)

--- PASS: TestAccAWSVpnGatewayAttachment_basic (50.52s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (63.85s)

…`InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces`

Previously in the acceptance testing (inconsistently):

```
--- FAIL: TestAccAwsDxGateway_complex (1395.94s)
    testing.go:696: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: Error detaching VPN Gateway "vgw-0cdff63748b555ce1" from VPC "vpc-03b0d4f907a594a7e": InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces

--- FAIL: TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount (753.92s)
    testing.go:696: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: Error detaching VPN Gateway "vgw-0347d6f94f7b41c56" from VPC "vpc-09e6a66d7f16b1df8": InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces

--- FAIL: TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount (1394.16s)
    testing.go:701: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: Error detaching VPN Gateway "vgw-0ff7518e32f5e9a41" from VPC "vpc-00285431f07f5bc9d": InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces
```

Example debug logging:

```
2019/12/18 06:09:29 [DEBUG] [aws-sdk-go] DEBUG: Response ec2/DetachVpnGateway Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Transfer-Encoding: chunked
Date: Wed, 18 Dec 2019 06:09:29 GMT
Server: AmazonEC2

-----------------------------------------------------
2019/12/18 06:09:29 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidParameterValue</Code><Message>This call cannot be completed because there are pending VPNs or Virtual Interfaces</Message></Error></Errors><RequestID>f951ecbf-328e-4fe3-be78-f02e8902da90</RequestID></Response>
2019/12/18 06:09:29 [DEBUG] [aws-sdk-go] DEBUG: Validate Response ec2/DetachVpnGateway failed, attempt 0/25, error InvalidParameterValue: This call cannot be completed because there are pending VPNs or Virtual Interfaces
  status code: 400, request id: f951ecbf-328e-4fe3-be78-f02e8902da90
```

Here we allow the retryable logic that applies to the `AttachVpnGateway` call to also apply to the `DetachVpnGateway` call.

Output from acceptance testing:

```
--- PASS: TestAccAwsDxGateway_basic (75.94s)
--- PASS: TestAccAwsDxGateway_complex (1442.22s)

--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount (1741.64s)
--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount (1561.21s)
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount (1067.31s)
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount (1064.09s)
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount (1135.38s)
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount (1164.79s)
--- PASS: TestAccAwsDxGatewayAssociation_deprecatedSingleAccount (1450.04s)
--- PASS: TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount (1160.43s)

--- PASS: TestAccAWSVpnGateway_basic (97.92s)
--- PASS: TestAccAWSVpnGateway_delete (67.50s)
--- PASS: TestAccAWSVpnGateway_disappears (56.04s)
--- PASS: TestAccAWSVpnGateway_reattach (128.44s)
--- PASS: TestAccAWSVpnGateway_tags (68.82s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (51.51s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (48.04s)

--- PASS: TestAccAWSVpnGatewayAttachment_basic (50.52s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (63.85s)
```
@bflad bflad requested a review from a team January 22, 2020 20:32
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. labels Jan 22, 2020
@bflad bflad added service/ec2 Issues and PRs that pertain to the ec2 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 22, 2020
Copy link
Contributor

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bflad bflad added this to the v2.53.0 milestone Mar 10, 2020
@bflad bflad merged commit fa03c89 into master Mar 10, 2020
@bflad bflad deleted the td-ec2-DetachVpnGateway-retries branch March 10, 2020 19:44
bflad added a commit that referenced this pull request Mar 10, 2020
@ghost
Copy link

ghost commented Mar 12, 2020

This has been released in version 2.53.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 Apr 10, 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 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
provider Pertains to the provider itself, rather than any interaction with AWS. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS 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