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

Sweeper: Add sweeper for aws_dms_replication_task #21554

Merged
merged 2 commits into from
Nov 5, 2021
Merged

Conversation

gdavison
Copy link
Contributor

The sweeper for aws_dms_replication_instance was failing due to an existing aws_dms_replication_task. Adds a sweeper for aws_dms_replication_task to unblock.

Also adds a dependency between the aws_subnet sweeper and the aws_dms_replication_instance sweeper, since aws_subnet was blocked.

Before change:

$ make sweep SWEEPARGS=-sweep-run=aws_dms_replication_instance

2021/10/29 16:37:37 [DEBUG] Running Sweepers for region (us-west-2):
2021/10/29 16:37:37 [DEBUG] Running Sweeper (aws_dms_replication_instance) in region (us-west-2)
2021/10/29 16:37:37 [INFO] Attempting to use session-derived credentials
2021/10/29 16:37:40 [INFO] Successfully derived credentials from session
2021/10/29 16:37:40 [INFO] AWS Auth provider used: "CredentialsEndpointProvider"
2021/10/29 16:37:40 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/10/29 16:37:41 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/10/29 16:37:42 [DEBUG] Waiting for state to become: [success]
2021/10/29 16:37:42 [DEBUG] DMS delete replication instance: {
  ReplicationInstanceArn: "arn:aws:dms:us-west-2:123456789012:rep:OAZ6SQKIHLR6VOHH3GSKCV36UOY7BRXKU6V7X3I"
}
2021/10/29 16:37:42 [DEBUG] Completed Sweeper (aws_dms_replication_instance) in region (us-west-2) in 5.527915206s
2021/10/29 16:37:42 [ERROR] Error running Sweeper (aws_dms_replication_instance) in region (us-west-2): 1 error occurred:
	* error sweeping DMS Replication Instances for us-west-2: 1 error occurred:
	* error deleting DMS Replication Instance (tf-test-1234): InvalidResourceStateFault: Replication Instance 'tf-test-1234' has one or more replication tasks.

After change:

$ make sweep SWEEPARGS=-sweep-run=aws_dms_replication_instance

2021/10/29 17:02:46 [DEBUG] Running Sweepers for region (us-west-2):
2021/10/29 17:02:46 [DEBUG] Running Sweeper (aws_dms_replication_task) in region (us-west-2)
2021/10/29 17:02:46 [INFO] Attempting to use session-derived credentials
2021/10/29 17:02:46 [INFO] Successfully derived credentials from session
2021/10/29 17:02:46 [INFO] AWS Auth provider used: "CredentialsEndpointProvider"
2021/10/29 17:02:46 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/10/29 17:02:46 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/10/29 17:02:47 [DEBUG] Waiting for state to become: [success]
2021/10/29 17:02:47 [DEBUG] DMS delete replication task: {
  ReplicationTaskArn: "arn:aws:dms:us-west-2: 123456789012:task:WJDPISB327EQHSJYC6M5KG4ZQUALG5OHZH6XH7I"
}
2021/10/29 17:02:48 [DEBUG] Waiting for state to become: []
2021/10/29 17:03:18 [DEBUG] Completed Sweeper (aws_dms_replication_task) in region (us-west-2) in 32.023665757s
2021/10/29 17:03:18 [DEBUG] Sweeper (aws_dms_replication_instance) has dependency (aws_dms_replication_task), running..
2021/10/29 17:03:18 [DEBUG] Sweeper (aws_dms_replication_task) already ran in region (us-west-2)
2021/10/29 17:03:18 [DEBUG] Running Sweeper (aws_dms_replication_instance) in region (us-west-2)
2021/10/29 17:03:18 [DEBUG] Waiting for state to become: [success]
2021/10/29 17:03:18 [DEBUG] DMS delete replication instance: {
  ReplicationInstanceArn: "arn:aws:dms:us-west-2: 123456789012:rep:OAZ6SQKIHLR6VOHH3GSKCV36UOY7BRXKU6V7X3I"
}
2021/10/29 17:03:18 [DEBUG] Waiting for state to become: []
2021/10/29 17:03:49 [TRACE] Waiting 10s before next try
2021/10/29 17:03:59 [TRACE] Waiting 10s before next try
2021/10/29 17:04:09 [TRACE] Waiting 10s before next try
2021/10/29 17:04:19 [TRACE] Waiting 10s before next try
2021/10/29 17:04:30 [TRACE] Waiting 10s before next try
2021/10/29 17:04:40 [TRACE] Waiting 10s before next try
2021/10/29 17:04:50 [TRACE] Waiting 10s before next try
2021/10/29 17:05:00 [DEBUG] Completed Sweeper (aws_dms_replication_instance) in region (us-west-2) in 1m42.388365832s
2021/10/29 17:05:00 Completed Sweepers for region (us-west-2) in 2m14.412154353s
2021/10/29 17:05:00 Sweeper Tests for region (us-west-2) ran successfully:
	- aws_dms_replication_task
	- aws_dms_replication_instance

@github-actions github-actions bot added size/S Managed by automation to categorize the size of a PR. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. service/databasemigrationservice service/ec2 Issues and PRs that pertain to the ec2 service. sweeper Pertains to changes to or issues with the sweeper. labels Oct 30, 2021
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make sweep SWEEPARGS=-sweep-run=aws_dms_replication_instance
# make sweep SWEEPARGS=-sweep-run=aws_example_thing
WARNING: This will destroy infrastructure. Use only in development accounts.
go test ./internal/sweep -v -tags=sweep -sweep=us-west-2,us-east-1,us-east-2 -sweep-run=aws_dms_replication_instance -timeout 60m
go: downloading github.com/aws/aws-sdk-go v1.41.10
2021/11/03 08:38:56 [DEBUG] Running Sweepers for region (us-west-2):
2021/11/03 08:38:56 [DEBUG] Sweeper (aws_dms_replication_instance) has dependency (aws_dms_replication_task), running..
2021/11/03 08:38:56 [DEBUG] Running Sweeper (aws_dms_replication_task) in region (us-west-2)
2021/11/03 08:38:56 [INFO] AWS Auth provider used: "EnvProvider"
2021/11/03 08:38:56 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/11/03 08:38:56 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/11/03 08:38:57 [DEBUG] Completed Sweeper (aws_dms_replication_task) in region (us-west-2) in 1.42337546s
2021/11/03 08:38:57 [DEBUG] Running Sweeper (aws_dms_replication_instance) in region (us-west-2)
2021/11/03 08:38:58 [DEBUG] Completed Sweeper (aws_dms_replication_instance) in region (us-west-2) in 361.375147ms
2021/11/03 08:38:58 [DEBUG] Sweeper (aws_dms_replication_task) already ran in region (us-west-2)
2021/11/03 08:38:58 Completed Sweepers for region (us-west-2) in 1.784957809s
2021/11/03 08:38:58 Sweeper Tests for region (us-west-2) ran successfully:
	- aws_dms_replication_task
	- aws_dms_replication_instance
2021/11/03 08:38:58 [DEBUG] Running Sweepers for region (us-east-1):
2021/11/03 08:38:58 [DEBUG] Sweeper (aws_dms_replication_instance) has dependency (aws_dms_replication_task), running..
2021/11/03 08:38:58 [DEBUG] Running Sweeper (aws_dms_replication_task) in region (us-east-1)
2021/11/03 08:38:58 [INFO] AWS Auth provider used: "EnvProvider"
2021/11/03 08:38:58 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/11/03 08:38:58 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/11/03 08:38:59 [DEBUG] Completed Sweeper (aws_dms_replication_task) in region (us-east-1) in 1.580672254s
2021/11/03 08:38:59 [DEBUG] Running Sweeper (aws_dms_replication_instance) in region (us-east-1)
2021/11/03 08:38:59 [DEBUG] Completed Sweeper (aws_dms_replication_instance) in region (us-east-1) in 129.827144ms
2021/11/03 08:38:59 [DEBUG] Sweeper (aws_dms_replication_task) already ran in region (us-east-1)
2021/11/03 08:38:59 Completed Sweepers for region (us-east-1) in 1.710547497s
2021/11/03 08:38:59 Sweeper Tests for region (us-east-1) ran successfully:
	- aws_dms_replication_instance
	- aws_dms_replication_task
2021/11/03 08:38:59 [DEBUG] Running Sweepers for region (us-east-2):
2021/11/03 08:38:59 [DEBUG] Sweeper (aws_dms_replication_instance) has dependency (aws_dms_replication_task), running..
2021/11/03 08:38:59 [DEBUG] Running Sweeper (aws_dms_replication_task) in region (us-east-2)
2021/11/03 08:38:59 [INFO] AWS Auth provider used: "EnvProvider"
2021/11/03 08:38:59 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/11/03 08:39:00 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/11/03 08:39:00 [DEBUG] Completed Sweeper (aws_dms_replication_task) in region (us-east-2) in 633.732816ms
2021/11/03 08:39:00 [DEBUG] Running Sweeper (aws_dms_replication_instance) in region (us-east-2)
2021/11/03 08:39:00 [DEBUG] Completed Sweeper (aws_dms_replication_instance) in region (us-east-2) in 126.337705ms
2021/11/03 08:39:00 [DEBUG] Sweeper (aws_dms_replication_task) already ran in region (us-east-2)
2021/11/03 08:39:00 Completed Sweepers for region (us-east-2) in 760.135976ms
2021/11/03 08:39:00 Sweeper Tests for region (us-east-2) ran successfully:
	- aws_dms_replication_task
	- aws_dms_replication_instance
ok  	github.com/hashicorp/terraform-provider-aws/internal/sweep	8.461s

@gdavison gdavison merged commit de17e73 into main Nov 5, 2021
@gdavison gdavison deleted the dms_sweeper branch November 5, 2021 23:48
@github-actions github-actions bot added this to the v3.65.0 milestone Nov 5, 2021
@github-actions
Copy link

This functionality has been released in v3.65.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. Thank you!

@github-actions
Copy link

github-actions bot commented Jun 9, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. service/ec2 Issues and PRs that pertain to the ec2 service. size/S Managed by automation to categorize the size of a PR. sweeper Pertains to changes to or issues with the sweeper.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants