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

tests/resource/aws_dx_gateway: Skip when associations (likely from other regions) remain as the gateway will fail to delete #10214

Merged
merged 1 commit into from
Sep 24, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Sep 24, 2019

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

Release note for CHANGELOG:

NONE

This sweeper is dependent on the Direct Connect Gateway Association sweeper to run prior, which may skip associations that are associated in a different region than the service client. This will leave lingering associations. Direct Connect Gateways with remaining associations will accept the DeleteDirectConnectGateway API call, enter the deleting state, then after a few minutes revert back to the available state. This causes the sweeper to fail, e.g.

[01:36:55][Step 2/4] 2019/09/24 01:36:55 [WARN] WaitForState timeout after 20m0s
[01:36:55][Step 2/4] 2019/09/24 01:36:55 [WARN] WaitForState starting 30s refresh grace period
[01:36:55][Step 2/4] 2019/09/24 01:36:55 [ERR] error running (aws_dx_gateway): error waiting for Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) to be deleted: timeout while waiting for state to become 'deleted' (last state: 'available', timeout: 20m0s)

Here we skip deleting the Direct Connect Gateway if associations remain as its likely the sweeper will run in the other region and later perform the deletion successfully.

Output from sweeper:

$ go test ./aws -v -sweep=us-east-1,us-west-2 -sweep-run=aws_dx_gateway -timeout 10h
2019/09/23 21:59:16 [DEBUG] Running Sweepers for region (us-east-1):
...
2019/09/23 21:59:18 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2019/09/23 21:59:18 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-east-1)
...
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) Association (vgw-0c30b4b34cfbbeda0) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) Association (vgw-0d6cb1878d8b05231) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (f279f38b-b6a6-4cdf-a376-9f1c5d99a4a4) Association (vgw-0202cd084f386200b) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (f279f38b-b6a6-4cdf-a376-9f1c5d99a4a4) Association (vgw-042795456737cc447) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (09a5ef37-651c-45ac-bab0-1e946dadf958) Association (vgw-087f7eb1fe70dcadb) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (cf2a0cfe-663e-4bb4-bedc-fb5535f46bd9) Association (vgw-06cdd41cfff5fae99) in different home region: us-west-2
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway) has dependency (aws_dx_gateway_association), running..
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-east-1)
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway_association) already ran in region (us-east-1)
...
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: ce06a898-143e-4740-a219-aa32bf564cca
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: f279f38b-b6a6-4cdf-a376-9f1c5d99a4a4
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: 09a5ef37-651c-45ac-bab0-1e946dadf958
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: cf2a0cfe-663e-4bb4-bedc-fb5535f46bd9
2019/09/23 21:59:20 Sweeper Tests ran:
	- aws_dx_gateway_association_proposal
	- aws_dx_gateway_association
	- aws_dx_gateway

As for deleting the associations in the correct region, the Direct Connect API is currently throwing server side errors:

2019/09/23 22:07:56 [ERR] error running (aws_dx_gateway_association): error deleting Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) Association (vgw-0d6cb1878d8b05231): DirectConnectServerException: Unable to process request

If they persist, we will need to open an AWS Support case. For now, I have manually deleted the associations via the console, which does not have this issue.

…her regions) remain as the gateway will fail to delete

This sweeper is dependent on the Direct Connect Gateway Association sweeper to run prior, which may skip associations that are associated in a different region than the service client. This will leave lingering associations. Direct Connect Gateways with remaining associations will accept the DeleteDirectConnectGateway API call, enter the deleting state, then after a few minutes revert back to the available state. This causes the sweeper to fail, e.g.

```
[01:36:55][Step 2/4] 2019/09/24 01:36:55 [WARN] WaitForState timeout after 20m0s
[01:36:55][Step 2/4] 2019/09/24 01:36:55 [WARN] WaitForState starting 30s refresh grace period
[01:36:55][Step 2/4] 2019/09/24 01:36:55 [ERR] error running (aws_dx_gateway): error waiting for Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) to be deleted: timeout while waiting for state to become 'deleted' (last state: 'available', timeout: 20m0s)
```

Here we skip deleting the Direct Connect Gateway if associations remain as its likely the sweeper will run in the other region and later perform the deletion successfully.

Output from sweeper:

```console
$ go test ./aws -v -sweep=us-east-1,us-west-2 -sweep-run=aws_dx_gateway -timeout 10h
2019/09/23 21:59:16 [DEBUG] Running Sweepers for region (us-east-1):
...
2019/09/23 21:59:18 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2019/09/23 21:59:18 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-east-1)
...
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) Association (vgw-0c30b4b34cfbbeda0) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) Association (vgw-0d6cb1878d8b05231) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (f279f38b-b6a6-4cdf-a376-9f1c5d99a4a4) Association (vgw-0202cd084f386200b) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (f279f38b-b6a6-4cdf-a376-9f1c5d99a4a4) Association (vgw-042795456737cc447) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (09a5ef37-651c-45ac-bab0-1e946dadf958) Association (vgw-087f7eb1fe70dcadb) in different home region: us-west-2
2019/09/23 21:59:19 [INFO] Skipping Direct Connect Gateway (cf2a0cfe-663e-4bb4-bedc-fb5535f46bd9) Association (vgw-06cdd41cfff5fae99) in different home region: us-west-2
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway) has dependency (aws_dx_gateway_association), running..
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway_association) has dependency (aws_dx_gateway_association_proposal), running..
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway_association_proposal) already ran in region (us-east-1)
2019/09/23 21:59:19 [DEBUG] Sweeper (aws_dx_gateway_association) already ran in region (us-east-1)
...
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: ce06a898-143e-4740-a219-aa32bf564cca
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: f279f38b-b6a6-4cdf-a376-9f1c5d99a4a4
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: 09a5ef37-651c-45ac-bab0-1e946dadf958
2019/09/23 21:59:20 [INFO] Skipping Direct Connect Gateway with remaining associations: cf2a0cfe-663e-4bb4-bedc-fb5535f46bd9
2019/09/23 21:59:20 Sweeper Tests ran:
	- aws_dx_gateway_association_proposal
	- aws_dx_gateway_association
	- aws_dx_gateway
```

As for deleting the associations in the correct region, the Direct Connect API is currently throwing server side errors:

```
2019/09/23 22:07:56 [ERR] error running (aws_dx_gateway_association): error deleting Direct Connect Gateway (ce06a898-143e-4740-a219-aa32bf564cca) Association (vgw-0d6cb1878d8b05231): DirectConnectServerException: Unable to process request
```

If they persist, we will need to open an AWS Support case. For now, I have manually deleted the associations via the console, which does not have this issue.
@bflad bflad requested a review from a team September 24, 2019 02:23
@ghost ghost added size/S Managed by automation to categorize the size of a PR. service/directconnect Issues and PRs that pertain to the directconnect service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Sep 24, 2019
Copy link
Contributor

@nywilken nywilken 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.30.0 milestone Sep 24, 2019
@bflad bflad merged commit 9d84c9b into master Sep 24, 2019
@bflad bflad deleted the t-aws_dx_gateway-sweeper-cross-region-associations branch September 24, 2019 02:58
@ghost
Copy link

ghost commented Sep 26, 2019

This has been released in version 2.30.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 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
service/directconnect Issues and PRs that pertain to the directconnect service. size/S 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.

2 participants