-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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/service/cloudformation: Add sweepers and export randomization #11725
Conversation
…e export names Previously in the acceptance testing: ``` --- FAIL: TestAccAWSCloudformationExportDataSource_basic (62.37s) testing.go:640: Step 0 error: errors during apply: Error: ROLLBACK_COMPLETE: ["Export with name waiter is already exported by stack tf-acc-test-38895184112636083521. Rollback requested by user."] ``` Exports are shared across active CloudFormation Stacks so here we randomize the export naming to prevent potential collisions. Output from acceptance testing: ``` --- PASS: TestAccAWSCloudformationExportDataSource_basic (33.97s) --- PASS: TestAccAWSCloudformationExportDataSource_ResourceReference (74.04s) ```
Output from sweeper: ```console $ aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE IMPORT_COMPLETE ROLLBACK_COMPLETE UPDATE_COMPLETE | jq '.StackSummaries | length' 41 $ aws cloudformation list-stack-sets --status ACTIVE | jq '.Summaries | length' 93 $ go test ./aws -v -timeout=10h -sweep=us-west-2 -sweep-run=aws_cloudformation_stack,aws_cloudformation_stack_set -sweep-allow-failures 2020/01/22 20:28:36 [DEBUG] Running Sweepers for region (us-west-2): 2020/01/22 20:28:36 [DEBUG] Running Sweeper (aws_cloudformation_stack_set_instance) in region (us-west-2) ... 2020/01/22 20:28:40 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-2881910219948525356 / --OMITTED-- / us-west-2 ... 2020/01/22 20:29:14 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-3340522403724533256 / --OMITTED-- / us-west-2 ... 2020/01/22 20:29:49 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-3993748121930134008 / --OMITTED-- / us-west-2 ... 2020/01/22 20:30:24 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-4090453630593047948 / --OMITTED-- / us-west-2 ... 2020/01/22 20:30:58 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-5155795199068739258 / --OMITTED-- / us-west-2 ... 2020/01/22 20:31:33 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-6372546011565745789 / --OMITTED-- / us-west-2 ... 2020/01/22 20:32:08 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-6820169250462986145 / --OMITTED-- / us-west-2 ... 2020/01/22 20:32:42 [INFO] Deleting CloudFormation Stack Set Instance: tf-acc-test-6874637500634692748 / --OMITTED-- / us-west-2 ... 2020/01/22 20:33:27 [DEBUG] Sweeper (aws_cloudformation_stack) has dependency (aws_cloudformation_stack_set_instance), running.. 2020/01/22 20:33:27 [DEBUG] Sweeper (aws_cloudformation_stack_set_instance) already ran in region (us-west-2) 2020/01/22 20:33:27 [DEBUG] Running Sweeper (aws_cloudformation_stack) in region (us-west-2) ... 2020/01/22 20:33:29 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-6321312072961934498 2020/01/22 20:33:30 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-7949902434600260276 2020/01/22 20:33:30 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-1646727646471833966-9ceb7bad-dca1-44a5-930d-558e9776809d 2020/01/22 20:33:31 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-4903187710294631207 2020/01/22 20:33:31 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-910044256175885731 2020/01/22 20:33:32 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-1686520734185663901 2020/01/22 20:33:32 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-3867305924253287722 2020/01/22 20:33:33 [INFO] Deleting CloudFormation Stack: tf-acc-test-90508645576171621012 2020/01/22 20:33:33 [INFO] Deleting CloudFormation Stack: tf-acc-test-90508645576171621011 2020/01/22 20:33:34 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-1773332007499659163-9b9eae3b-b031-4cc2-ae75-841aec028be6 2020/01/22 20:33:34 [INFO] Deleting CloudFormation Stack: tf-acc-ds-basic-55389185272653002 2020/01/22 20:33:35 [INFO] Deleting CloudFormation Stack: tf-acc-ds-basic-7813158390752904838 2020/01/22 20:33:35 [INFO] Deleting CloudFormation Stack: tf-acc-ds-yaml-8255492713875577306 2020/01/22 20:33:36 [INFO] Deleting CloudFormation Stack: tf-acc-ds-basic-6818865422926113135 2020/01/22 20:33:36 [INFO] Deleting CloudFormation Stack: tf-acc-ds-yaml-2792875247474377558 2020/01/22 20:33:37 [INFO] Deleting CloudFormation Stack: tf-acc-ds-basic-5074931548181917345 2020/01/22 20:33:37 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-2683457473612474517 2020/01/22 20:33:38 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-4887388094849677138-58049b35-2822-40a7-b9e1-c35bd28f3484 2020/01/22 20:33:38 [INFO] Deleting CloudFormation Stack: tf-acc-test-38895184112636083521 2020/01/22 20:33:39 [INFO] Deleting CloudFormation Stack: tf-acc-test-38895184112636083522 2020/01/22 20:33:39 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-3990884545323935307 2020/01/22 20:33:40 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-2697336824172157948 2020/01/22 20:33:40 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-5237290395841689733 2020/01/22 20:33:41 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-5597160963348782967 2020/01/22 20:33:42 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-4307371716714238094 2020/01/22 20:33:42 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-3926345700388647725-c87d1990-8cfe-422a-8bae-f64959ee1c19 2020/01/22 20:33:43 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-3750979215615596588-b92e8173-a2dd-4d65-a856-7f3b960f5f43 2020/01/22 20:33:43 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-3657003669524264781-1335a2c8-4eef-4b9c-943a-d766534763f5 2020/01/22 20:33:44 [INFO] Deleting CloudFormation Stack: aws-cloud9-tf-acc-env-basic-j1nbjhw9-7c91f37ef59341beb263624bfe3b42c9 2020/01/22 20:33:44 [INFO] Deleting CloudFormation Stack: aws-cloud9-tf-acc-api-doc-part-import-p3s8ydqr-8827d2ca631f48d4b55b67951d990ae5 2020/01/22 20:33:45 [INFO] Deleting CloudFormation Stack: aws-cloud9-tf-acc-env-basic-92yb8mi1-fbff8e1ce9fe46cfab7d509e80100710 2020/01/22 20:33:46 [DEBUG] Sweeper (aws_cloudformation_stack_set) has dependency (aws_cloudformation_stack_set_instance), running.. 2020/01/22 20:33:46 [DEBUG] Sweeper (aws_cloudformation_stack_set_instance) already ran in region (us-west-2) 2020/01/22 20:33:46 [DEBUG] Running Sweeper (aws_cloudformation_stack_set) in region (us-west-2) ... 2020/01/22 20:33:47 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-2307474257448478076 2020/01/22 20:33:48 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-2881910219948525356 2020/01/22 20:33:49 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-3340522403724533256 2020/01/22 20:33:50 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-3993748121930134008 2020/01/22 20:33:50 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-4090453630593047948 2020/01/22 20:33:51 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-5155795199068739258 2020/01/22 20:33:52 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-6372546011565745789 2020/01/22 20:33:52 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-6820169250462986145 2020/01/22 20:33:53 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-6874637500634692748 2020/01/22 20:36:39 Sweeper Tests ran successfully: - aws_cloudformation_stack - aws_cloudformation_stack_set - aws_cloudformation_stack_set_instance ok github.com/terraform-providers/terraform-provider-aws/aws 319.576s $ aws cloudformation list-stack-sets --status ACTIVE | jq '.Summaries | length' 0 $ aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE IMPORT_COMPLETE ROLLBACK_COMPLETE UPDATE_COMPLETE | jq '.StackSummaries | length' 0 ```
f01b1b6
to
cbe6531
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Output from acceptance tests:
$ make testacc TESTARGS='-run=TestAccAWSCloudformationExportDataSource_'
--- PASS: TestAccAWSCloudformationExportDataSource_basic (35.78s)
--- PASS: TestAccAWSCloudformationExportDataSource_ResourceReference (74.30s)
Output from sweepers:
$ aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE IMPORT_COMPLETE ROLLBACK_COMPLETE UPDATE_COMPLETE | jq '.StackSummaries | length'
9
$ aws cloudformation list-stack-sets --status ACTIVE | jq '.Summaries | length'
6
$ go test ./aws -v -timeout=10h -sweep=us-west-2 -sweep-run=aws_cloudformation_stack,aws_cloudformation_stack_set -sweep-allow-failures
2020/02/03 15:40:25 [DEBUG] Running Sweepers for region (us-west-2):
2020/02/03 15:40:25 [DEBUG] Running Sweeper (aws_cloudformation_stack_set_instance) in region (us-west-2)
2020/02/03 15:40:25 [INFO] Building AWS auth structure
2020/02/03 15:40:25 [INFO] Setting AWS metadata API timeout to 100ms
2020/02/03 15:40:26 [INFO] Ignoring AWS metadata API endpoint at default location as it doesn't return any instance-id
2020/02/03 15:40:26 [INFO] AWS Auth provider used: "SharedCredentialsProvider"
2020/02/03 15:40:26 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/02/03 15:40:27 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/02/03 15:40:31 [DEBUG] Sweeper (aws_cloudformation_stack) has dependency (aws_cloudformation_stack_set_instance), running..
2020/02/03 15:40:31 [DEBUG] Sweeper (aws_cloudformation_stack_set_instance) already ran in region (us-west-2)
2020/02/03 15:40:31 [DEBUG] Running Sweeper (aws_cloudformation_stack) in region (us-west-2)
2020/02/03 15:40:31 [INFO] Building AWS auth structure
2020/02/03 15:40:31 [INFO] Setting AWS metadata API timeout to 100ms
2020/02/03 15:40:32 [INFO] Ignoring AWS metadata API endpoint at default location as it doesn't return any instance-id
2020/02/03 15:40:32 [INFO] AWS Auth provider used: "SharedCredentialsProvider"
2020/02/03 15:40:32 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/02/03 15:40:32 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/02/03 15:40:33 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-7300049432689569850
2020/02/03 15:40:33 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-6109682288642141104-dff2d522-9f86-4f44-a233-89ded79084f9
2020/02/03 15:40:33 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-9078946241921815747
2020/02/03 15:40:34 [INFO] Deleting CloudFormation Stack: StackSet-tf-acc-test-1424302021274400602-6ac5f8ff-05f6-4ae9-8e46-b20662c23372
2020/02/03 15:40:34 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-1272345076082805455
2020/02/03 15:40:34 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-9058478858013554368
2020/02/03 15:40:35 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-5733856693260614781
2020/02/03 15:40:35 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-4982469654294543543
2020/02/03 15:40:35 [INFO] Deleting CloudFormation Stack: tf-acc-test-s3tags-3675731745578574476
2020/02/03 15:40:35 [DEBUG] Sweeper (aws_cloudformation_stack_set) has dependency (aws_cloudformation_stack_set_instance), running..
2020/02/03 15:40:35 [DEBUG] Sweeper (aws_cloudformation_stack_set_instance) already ran in region (us-west-2)
2020/02/03 15:40:35 [DEBUG] Running Sweeper (aws_cloudformation_stack_set) in region (us-west-2)
2020/02/03 15:40:35 [INFO] Building AWS auth structure
2020/02/03 15:40:35 [INFO] Setting AWS metadata API timeout to 100ms
2020/02/03 15:40:36 [INFO] Ignoring AWS metadata API endpoint at default location as it doesn't return any instance-id
2020/02/03 15:40:36 [INFO] AWS Auth provider used: "SharedCredentialsProvider"
2020/02/03 15:40:36 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/02/03 15:40:36 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/02/03 15:40:37 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-1328867655645418790
2020/02/03 15:40:38 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-2359705917917265789
2020/02/03 15:40:38 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-4634541847143495612
2020/02/03 15:40:39 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-5533992943535517742
2020/02/03 15:40:39 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-6495803857455870599
2020/02/03 15:40:39 [INFO] Deleting CloudFormation Stack Set: tf-acc-test-7500990026820729313
2020/02/03 15:40:40 Sweeper Tests ran successfully:
- aws_cloudformation_stack_set_instance
- aws_cloudformation_stack
- aws_cloudformation_stack_set
ok github.com/terraform-providers/terraform-provider-aws/aws 18.762s
$ aws cloudformation list-stack-sets --status ACTIVE | jq '.Summaries | length'
0
$ aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE IMPORT_COMPLETE ROLLBACK_COMPLETE UPDATE_COMPLETE | jq '.StackSummaries | length'
0
This has been released in version 2.48.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! |
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! |
Community Note
Release note for CHANGELOG:
Previously in the acceptance testing:
Exports are shared across active CloudFormation Stacks so here we randomize the export naming to prevent potential collisions.
Output from acceptance testing:
Output from sweepers: