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_vpn_gateway,r/aws_vpn_gateway_attachment: Increase detach timeout to 30 mins #15201

Merged

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Sep 17, 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

Closes #15164.
Relates #13826.
Relates #13527.

Release note for CHANGELOG:

resource/aws_vpn_gateway: Increase VPC detach timeout to 30 minutes
resource/aws_vpn_gateway_attachment: Increase VPC detach timeout to 30 minutes

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSVpnGatewayAttachment_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSVpnGatewayAttachment_ -timeout 120m
=== RUN   TestAccAWSVpnGatewayAttachment_basic
=== PAUSE TestAccAWSVpnGatewayAttachment_basic
=== RUN   TestAccAWSVpnGatewayAttachment_deleted
=== PAUSE TestAccAWSVpnGatewayAttachment_deleted
=== CONT  TestAccAWSVpnGatewayAttachment_basic
=== CONT  TestAccAWSVpnGatewayAttachment_deleted
    resource_aws_vpn_gateway_attachment_test.go:40: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (33.77s)
--- PASS: TestAccAWSVpnGatewayAttachment_basic (38.51s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       38.552s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSVpnGateway_' ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSVpnGateway_ -timeout 120m
=== 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  TestAccAWSVpnGateway_basic
=== CONT  TestAccAWSVpnGateway_reattach
--- PASS: TestAccAWSVpnGateway_basic (87.01s)
=== CONT  TestAccAWSVpnGateway_tags
--- PASS: TestAccAWSVpnGateway_reattach (123.40s)
=== CONT  TestAccAWSVpnGateway_delete
--- PASS: TestAccAWSVpnGateway_delete (60.46s)
=== CONT  TestAccAWSVpnGateway_withAmazonSideAsnSetToState
--- PASS: TestAccAWSVpnGateway_tags (97.73s)
=== CONT  TestAccAWSVpnGateway_disappears
    resource_aws_vpn_gateway_test.go:195: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSVpnGateway_disappears (40.79s)
=== CONT  TestAccAWSVpnGateway_withAvailabilityZoneSetToState
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (52.12s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (47.02s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	272.597s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsDxGatewayAssociation_' ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAwsDxGatewayAssociation_ -timeout 120m
=== RUN   TestAccAwsDxGatewayAssociation_V0StateUpgrade
=== PAUSE TestAccAwsDxGatewayAssociation_V0StateUpgrade
=== RUN   TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount
=== PAUSE TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount
=== RUN   TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount
=== PAUSE TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount
=== RUN   TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount
=== PAUSE TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount
=== RUN   TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount
=== PAUSE TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount
=== RUN   TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount
=== PAUSE TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount
=== RUN   TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount
=== PAUSE TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount
=== RUN   TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount
=== PAUSE TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount
=== CONT  TestAccAwsDxGatewayAssociation_V0StateUpgrade
=== CONT  TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount
--- PASS: TestAccAwsDxGatewayAssociation_V0StateUpgrade (1706.49s)
=== CONT  TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount
--- PASS: TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount (2020.36s)
=== CONT  TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount
=== CONT  TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount
    resource_aws_dx_gateway_association_test.go:439: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount (1639.71s)
=== CONT  TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount
--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount (2124.15s)
=== CONT  TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount (1058.63s)
=== CONT  TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount (1180.31s)
=== CONT  TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount (1885.15s)
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount (1593.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	6604.396s
  • Refactored aws_vpn_gateway_attachment to use internal finder and waiters package
  • Refactored aws_vpn_gateway to use internal waiters package for attachment state
  • Increased detach timeout from 15 minutes to 30 minutes to fix occasional timeout errors in the aws_dx_gateway_association acceptance tests

…aiter' packages. Increase detachment timeout to 30m.

Acceptance test output:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSVpnGatewayAttachment_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSVpnGatewayAttachment_ -timeout 120m
=== RUN   TestAccAWSVpnGatewayAttachment_basic
=== PAUSE TestAccAWSVpnGatewayAttachment_basic
=== RUN   TestAccAWSVpnGatewayAttachment_deleted
=== PAUSE TestAccAWSVpnGatewayAttachment_deleted
=== CONT  TestAccAWSVpnGatewayAttachment_basic
=== CONT  TestAccAWSVpnGatewayAttachment_deleted
    resource_aws_vpn_gateway_attachment_test.go:40: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (33.77s)
--- PASS: TestAccAWSVpnGatewayAttachment_basic (38.51s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	38.552s
…aws_vpn_gateway_attachment Delete methods.

Acceptance test output:

$ TEST=./aws SWEEP=us-west-2,us-east-1 SWEEPARGS=-sweep-run=aws_vpn_gateway make sweep
WARNING: This will destroy infrastructure. Use only in development accounts.
go test ./aws -v -sweep=us-west-2,us-east-1 -sweep-run=aws_vpn_gateway -timeout 60m
2020/09/17 14:01:43 [DEBUG] Running Sweepers for region (us-west-2):
2020/09/17 14:01:43 [DEBUG] Sweeper (aws_vpn_gateway) has dependency (aws_dx_gateway_association), running..
2020/09/17 14:01:43 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2020/09/17 14:01:43 [DEBUG] Running Sweeper (aws_dx_gateway_association_proposal) in region (us-west-2)
2020/09/17 14:01:43 [INFO] AWS Auth provider used: "EnvProvider"
2020/09/17 14:01:43 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/09/17 14:01:44 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/09/17 14:01:45 [DEBUG] Running Sweeper (aws_dx_gateway_association) in region (us-west-2)
2020/09/17 14:01:46 [DEBUG] Running Sweeper (aws_vpn_gateway) in region (us-west-2)
2020/09/17 14:01:46 [INFO] Deleting VPN Gateway (vgw-0b8054188ab62b680) Attachment (vpc-f2e16e8b)
2020/09/17 14:01:47 [DEBUG] Waiting for state to become: [detached]
2020/09/17 14:01:47 [DEBUG] Not detaching VPN Gateway 'vgw-0b8054188ab62b680' as no VPC ID is set
2020/09/17 14:01:47 [INFO] Deleting VPN gateway: vgw-0b8054188ab62b680
2020/09/17 14:01:47 [DEBUG] Waiting for state to become: [success]
2020/09/17 14:01:48 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2020/09/17 14:01:48 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-west-2)
2020/09/17 14:01:48 [DEBUG] Sweeper (aws_dx_gateway_association) already ran in region (us-west-2)
2020/09/17 14:01:48 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-west-2)
2020/09/17 14:01:48 Sweeper Tests ran successfully:
	- aws_vpn_gateway
	- aws_dx_gateway_association_proposal
	- aws_dx_gateway_association
2020/09/17 14:01:48 [DEBUG] Running Sweepers for region (us-east-1):
2020/09/17 14:01:48 [DEBUG] Sweeper (aws_vpn_gateway) has dependency (aws_dx_gateway_association), running..
2020/09/17 14:01:48 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2020/09/17 14:01:48 [DEBUG] Running Sweeper (aws_dx_gateway_association_proposal) in region (us-east-1)
2020/09/17 14:01:48 [INFO] AWS Auth provider used: "EnvProvider"
2020/09/17 14:01:48 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/09/17 14:01:48 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/09/17 14:01:48 [DEBUG] Running Sweeper (aws_dx_gateway_association) in region (us-east-1)
2020/09/17 14:01:49 [DEBUG] Running Sweeper (aws_vpn_gateway) in region (us-east-1)
2020/09/17 14:01:49 [DEBUG] No VPN Gateways to sweep
2020/09/17 14:01:49 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2020/09/17 14:01:49 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-east-1)
2020/09/17 14:01:49 [DEBUG] Sweeper (aws_dx_gateway_association) already ran in region (us-east-1)
2020/09/17 14:01:49 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-east-1)
2020/09/17 14:01:49 Sweeper Tests ran successfully:
	- aws_dx_gateway_association_proposal
	- aws_dx_gateway_association
	- aws_vpn_gateway
ok  	github.com/terraform-providers/terraform-provider-aws/aws	5.308s
… detachment timeout to 30m.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSVpnGateway_' ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSVpnGateway_ -timeout 120m
=== 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  TestAccAWSVpnGateway_basic
=== CONT  TestAccAWSVpnGateway_reattach
--- PASS: TestAccAWSVpnGateway_basic (87.01s)
=== CONT  TestAccAWSVpnGateway_tags
--- PASS: TestAccAWSVpnGateway_reattach (123.40s)
=== CONT  TestAccAWSVpnGateway_delete
--- PASS: TestAccAWSVpnGateway_delete (60.46s)
=== CONT  TestAccAWSVpnGateway_withAmazonSideAsnSetToState
--- PASS: TestAccAWSVpnGateway_tags (97.73s)
=== CONT  TestAccAWSVpnGateway_disappears
    resource_aws_vpn_gateway_test.go:195: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSVpnGateway_disappears (40.79s)
=== CONT  TestAccAWSVpnGateway_withAvailabilityZoneSetToState
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (52.12s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (47.02s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	272.597s
@ewbankkit ewbankkit requested a review from a team September 17, 2020 18:16
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Sep 17, 2020
Comment on lines +481 to +488
resource "aws_vpc" "test" {
cidr_block = "10.1.0.0/16"

tags = {
Name = "terraform-testacc-vpn-gateway"
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Else

=== CONT  TestAccAWSVpnGateway_basic
    resource_aws_vpn_gateway_test.go:119: Step 3/3 error: terraform failed: exit status 1
        
        stderr:
        
        Error: Error deleting VPC: DependencyViolation: The vpc 'vpc-00e1f817ec8e815b1' has dependencies and cannot be deleted.
        	status code: 400, request id: 75fd77ad-805e-47a5-bc10-9fd380522c7d
        
        
--- FAIL: TestAccAWSVpnGateway_basic (357.00s)

Copy link
Member

Choose a reason for hiding this comment

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

This change is totally fine (while maybe create_before_destroy in the previous test configuration would "correctly" fix this), but this upstream issue has a little more context about the (IMO unexpected 😉 ) ordering behavior: hashicorp/terraform#26173

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did the order of operations change with TF 0.12?
This test must have been running fine with the "internal" version of TF used to run acceptance tests before migration to Plugin SDK v2.

Copy link
Member

Choose a reason for hiding this comment

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

I believe so, at some point during the Terraform 0.12.x line between 0.12.7 (~ when the SDK version of core was split) and 0.12.26 (the first version the binary testing framework really supports).

@ewbankkit ewbankkit changed the title [WIP] r/aws_vpn_gateway,r/aws_vpn_gateway_attachment: Increase detach timeout to 30 mins r/aws_vpn_gateway,r/aws_vpn_gateway_attachment: Increase detach timeout to 30 mins Sep 17, 2020
@bflad bflad added the bug Addresses a defect in current functionality. label Sep 17, 2020
@bflad bflad self-assigned this Sep 17, 2020
Copy link
Member

@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.

Looks good, thanks for sorting through this @ewbankkit 🚀

Output from acceptance testing:

--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount (2018.88s)
--- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount (2016.71s)
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount (1222.51s)
--- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount (1113.89s)
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount (1585.12s)
--- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount (1579.86s)
--- PASS: TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount (1837.55s)
--- PASS: TestAccAwsDxGatewayAssociation_V0StateUpgrade (1535.33s)

--- PASS: TestAccAWSVpnGateway_basic (104.58s)
--- PASS: TestAccAWSVpnGateway_delete (72.67s)
--- PASS: TestAccAWSVpnGateway_disappears (48.04s)
--- PASS: TestAccAWSVpnGateway_reattach (142.71s)
--- PASS: TestAccAWSVpnGateway_tags (103.01s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (94.95s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (62.10s)

--- PASS: TestAccAWSVpnGatewayAttachment_basic (54.65s)
--- PASS: TestAccAWSVpnGatewayAttachment_disappears (38.93s)

@bflad bflad added this to the v3.8.0 milestone Sep 18, 2020
@bflad bflad merged commit 5b496db into hashicorp:master Sep 18, 2020
bflad added a commit that referenced this pull request Sep 18, 2020
@ewbankkit ewbankkit deleted the t-aws_vpn_gateway-disassociate-timeout branch September 18, 2020 14:46
@ghost
Copy link

ghost commented Sep 24, 2020

This has been released in version 3.8.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 Oct 18, 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 as resolved and limited conversation to collaborators Oct 18, 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. service/ec2 Issues and PRs that pertain to the ec2 service. size/XL 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.

tests/resource/aws_dx_gateway_association: Occasional Timeout Errors on Destroy
2 participants