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

fix(r/aws_cloudformation_stack_set): handle auto_deployment enabled false #19092

Conversation

Steffen911
Copy link
Contributor

@Steffen911 Steffen911 commented Apr 23, 2021

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 #19015.
Closes #24879.
Closes #27294.

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSCloudFormationStackSet*'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudFormationStackSet* -timeout 180m
=== RUN   TestAccAWSCloudFormationStackSetInstance_basic
=== PAUSE TestAccAWSCloudFormationStackSetInstance_basic
=== RUN   TestAccAWSCloudFormationStackSetInstance_disappears
=== PAUSE TestAccAWSCloudFormationStackSetInstance_disappears
=== RUN   TestAccAWSCloudFormationStackSetInstance_disappears_StackSet
=== PAUSE TestAccAWSCloudFormationStackSetInstance_disappears_StackSet
=== RUN   TestAccAWSCloudFormationStackSetInstance_ParameterOverrides
=== PAUSE TestAccAWSCloudFormationStackSetInstance_ParameterOverrides
=== RUN   TestAccAWSCloudFormationStackSetInstance_RetainStack
=== PAUSE TestAccAWSCloudFormationStackSetInstance_RetainStack
=== RUN   TestAccAWSCloudFormationStackSet_basic
=== PAUSE TestAccAWSCloudFormationStackSet_basic
=== RUN   TestAccAWSCloudFormationStackSet_disappears
=== PAUSE TestAccAWSCloudFormationStackSet_disappears
=== RUN   TestAccAWSCloudFormationStackSet_AdministrationRoleArn
=== PAUSE TestAccAWSCloudFormationStackSet_AdministrationRoleArn
=== RUN   TestAccAWSCloudFormationStackSet_Description
=== PAUSE TestAccAWSCloudFormationStackSet_Description
=== RUN   TestAccAWSCloudFormationStackSet_ExecutionRoleName
=== PAUSE TestAccAWSCloudFormationStackSet_ExecutionRoleName
=== RUN   TestAccAWSCloudFormationStackSet_Name
=== PAUSE TestAccAWSCloudFormationStackSet_Name
=== RUN   TestAccAWSCloudFormationStackSet_Parameters
=== PAUSE TestAccAWSCloudFormationStackSet_Parameters
=== RUN   TestAccAWSCloudFormationStackSet_Parameters_Default
    provider_test.go:55: this resource does not currently ignore unconfigured CloudFormation template parameters with the Default property
--- SKIP: TestAccAWSCloudFormationStackSet_Parameters_Default (0.00s)
=== RUN   TestAccAWSCloudFormationStackSet_Parameters_NoEcho
    provider_test.go:55: this resource does not currently ignore CloudFormation template parameters with the NoEcho property
--- SKIP: TestAccAWSCloudFormationStackSet_Parameters_NoEcho (0.00s)
=== RUN   TestAccAWSCloudFormationStackSet_AutoDeployment_Enabled
=== PAUSE TestAccAWSCloudFormationStackSet_AutoDeployment_Enabled
=== RUN   TestAccAWSCloudFormationStackSet_AutoDeployment_Disabled
=== PAUSE TestAccAWSCloudFormationStackSet_AutoDeployment_Disabled
=== RUN   TestAccAWSCloudFormationStackSet_PermissionModel_ServiceManaged
    provider_test.go:55: API does not support enabling Organizations access (in particular, creating the Stack Sets IAM Service-Linked Role)
--- SKIP: TestAccAWSCloudFormationStackSet_PermissionModel_ServiceManaged (0.00s)
=== RUN   TestAccAWSCloudFormationStackSet_Tags
=== PAUSE TestAccAWSCloudFormationStackSet_Tags
=== RUN   TestAccAWSCloudFormationStackSet_TemplateBody
=== PAUSE TestAccAWSCloudFormationStackSet_TemplateBody
=== RUN   TestAccAWSCloudFormationStackSet_TemplateUrl
=== PAUSE TestAccAWSCloudFormationStackSet_TemplateUrl
=== CONT  TestAccAWSCloudFormationStackSetInstance_basic
=== CONT  TestAccAWSCloudFormationStackSet_ExecutionRoleName
=== CONT  TestAccAWSCloudFormationStackSet_AutoDeployment_Enabled
=== CONT  TestAccAWSCloudFormationStackSet_Parameters
=== CONT  TestAccAWSCloudFormationStackSet_Name
=== CONT  TestAccAWSCloudFormationStackSet_TemplateBody
=== CONT  TestAccAWSCloudFormationStackSet_AutoDeployment_Disabled
=== CONT  TestAccAWSCloudFormationStackSet_TemplateUrl
=== CONT  TestAccAWSCloudFormationStackSet_disappears
=== CONT  TestAccAWSCloudFormationStackSetInstance_disappears_StackSet
=== CONT  TestAccAWSCloudFormationStackSet_AdministrationRoleArn
=== CONT  TestAccAWSCloudFormationStackSetInstance_disappears
=== CONT  TestAccAWSCloudFormationStackSetInstance_RetainStack
=== CONT  TestAccAWSCloudFormationStackSetInstance_ParameterOverrides
=== CONT  TestAccAWSCloudFormationStackSet_Description
=== CONT  TestAccAWSCloudFormationStackSet_basic
=== CONT  TestAccAWSCloudFormationStackSet_Tags
--- PASS: TestAccAWSCloudFormationStackSet_disappears (95.41s)
--- PASS: TestAccAWSCloudFormationStackSet_AutoDeployment_Disabled (98.51s)
--- PASS: TestAccAWSCloudFormationStackSet_AutoDeployment_Enabled (98.90s)
--- PASS: TestAccAWSCloudFormationStackSet_basic (107.42s)
=== CONT  TestAccAWSCloudFormationStackSetInstance_ParameterOverrides
    resource_aws_cloudformation_stack_set_instance_test.go:191: Step 1/5 error: Error running apply: exit status 1

        Error: error waiting for CloudFormation StackSet Instance (tf-acc-test-2289018479073521348,296279532195,us-west-2) creation: Operation (terraform-2021042318365859090000001a) Results:
        Account (<account_id>) Region (us-west-2) Status (FAILED) Status Reason: ResourceLogicalId:TestVpc, ResourceType:AWS::EC2::VPC, ResourceStatusReason:The maximum number of VPCs has been reached. (Service: AmazonEC2; Status Code: 400; Error Code: VpcLimitExceeded; Request ID: edc78b1d-fa26-4a7c-bdf5-06e0c9f946b2; Proxy: null).

          on terraform_plugin_test.tf line 128, in resource "aws_cloudformation_stack_set_instance" "test":
         128: resource "aws_cloudformation_stack_set_instance" "test" {


=== CONT  TestAccAWSCloudFormationStackSetInstance_disappears_StackSet
    resource_aws_cloudformation_stack_set_instance_test.go:166: Step 1/1 error: Error running apply: exit status 1

        Error: error waiting for CloudFormation StackSet Instance (tf-acc-test-6958311671887759796,296279532195,us-west-2) creation: Operation (terraform-2021042318365986370000001b) Results:
        Account (<account_id>) Region (us-west-2) Status (FAILED) Status Reason: ResourceLogicalId:TestVpc, ResourceType:AWS::EC2::VPC, ResourceStatusReason:The maximum number of VPCs has been reached. (Service: AmazonEC2; Status Code: 400; Error Code: VpcLimitExceeded; Request ID: 219fa778-f2bc-4918-ba6e-5b22f204cc12; Proxy: null).

          on terraform_plugin_test.tf line 128, in resource "aws_cloudformation_stack_set_instance" "test":
         128: resource "aws_cloudformation_stack_set_instance" "test" {


--- FAIL: TestAccAWSCloudFormationStackSetInstance_ParameterOverrides (135.51s)
--- FAIL: TestAccAWSCloudFormationStackSetInstance_disappears_StackSet (145.32s)
--- PASS: TestAccAWSCloudFormationStackSet_ExecutionRoleName (153.61s)
--- PASS: TestAccAWSCloudFormationStackSet_TemplateBody (155.74s)
--- PASS: TestAccAWSCloudFormationStackSet_AdministrationRoleArn (157.07s)
--- PASS: TestAccAWSCloudFormationStackSet_Description (160.73s)
--- PASS: TestAccAWSCloudFormationStackSet_Name (164.64s)
--- PASS: TestAccAWSCloudFormationStackSetInstance_disappears (187.69s)
--- PASS: TestAccAWSCloudFormationStackSet_TemplateUrl (195.76s)
--- PASS: TestAccAWSCloudFormationStackSetInstance_basic (204.53s)
--- PASS: TestAccAWSCloudFormationStackSet_Parameters (242.13s)
--- PASS: TestAccAWSCloudFormationStackSet_Tags (242.90s)
--- PASS: TestAccAWSCloudFormationStackSetInstance_RetainStack (316.25s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	318.002s
FAIL
make: *** [testacc] Error 1

@Steffen911 Steffen911 requested a review from a team as a code owner April 23, 2021 18:58
@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/cloudformation Issues and PRs that pertain to the cloudformation service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 23, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 23, 2021
@Steffen911 Steffen911 marked this pull request as draft April 23, 2021 18:59
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @Steffen911 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@Steffen911 Steffen911 marked this pull request as ready for review April 23, 2021 22:06
@Steffen911 Steffen911 changed the title fix(r/aws_cloudformation_stack_set): handle auto_deployment false fix(r/aws_cloudformation_stack_set): handle auto_deployment enabled false Apr 23, 2021
@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 4, 2021
@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

# Conflicts:
#	internal/service/cloudformation/stack_set_test.go
… = "DELEGATED_ADMIN"` via _<StackSetName>_/_<CallAs>_ syntax for `import` block or `terraform import` command.
… `call_as = "DELEGATED_ADMIN"` via _<StackSetName>_,_<AccountID>_,_<Region>_,_<CallAs>_ syntax for `import` block or `terraform import` command.
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. and removed size/M Managed by automation to categorize the size of a PR. labels Aug 31, 2023
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 testacc TESTARGS='-run=TestAccCloudFormationStackSet_\|TestAccCloudFormationStackSetInstance_' PKG=cloudformation ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/cloudformation/... -v -count 1 -parallel 2  -run=TestAccCloudFormationStackSet_\|TestAccCloudFormationStackSetInstance_ -timeout 180m
=== RUN   TestAccCloudFormationStackSetInstance_basic
=== PAUSE TestAccCloudFormationStackSetInstance_basic
=== RUN   TestAccCloudFormationStackSetInstance_disappears
=== PAUSE TestAccCloudFormationStackSetInstance_disappears
=== RUN   TestAccCloudFormationStackSetInstance_Disappears_stackSet
=== PAUSE TestAccCloudFormationStackSetInstance_Disappears_stackSet
=== RUN   TestAccCloudFormationStackSetInstance_parameterOverrides
=== PAUSE TestAccCloudFormationStackSetInstance_parameterOverrides
=== RUN   TestAccCloudFormationStackSetInstance_retainStack
=== PAUSE TestAccCloudFormationStackSetInstance_retainStack
=== RUN   TestAccCloudFormationStackSetInstance_deploymentTargets
=== PAUSE TestAccCloudFormationStackSetInstance_deploymentTargets
=== RUN   TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== PAUSE TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== RUN   TestAccCloudFormationStackSetInstance_operationPreferences
=== PAUSE TestAccCloudFormationStackSetInstance_operationPreferences
=== RUN   TestAccCloudFormationStackSet_basic
=== PAUSE TestAccCloudFormationStackSet_basic
=== RUN   TestAccCloudFormationStackSet_disappears
=== PAUSE TestAccCloudFormationStackSet_disappears
=== RUN   TestAccCloudFormationStackSet_administrationRoleARN
=== PAUSE TestAccCloudFormationStackSet_administrationRoleARN
=== RUN   TestAccCloudFormationStackSet_description
=== PAUSE TestAccCloudFormationStackSet_description
=== RUN   TestAccCloudFormationStackSet_executionRoleName
=== PAUSE TestAccCloudFormationStackSet_executionRoleName
=== RUN   TestAccCloudFormationStackSet_managedExecution
=== PAUSE TestAccCloudFormationStackSet_managedExecution
=== RUN   TestAccCloudFormationStackSet_name
=== PAUSE TestAccCloudFormationStackSet_name
=== RUN   TestAccCloudFormationStackSet_operationPreferences
=== PAUSE TestAccCloudFormationStackSet_operationPreferences
=== RUN   TestAccCloudFormationStackSet_parameters
=== PAUSE TestAccCloudFormationStackSet_parameters
=== RUN   TestAccCloudFormationStackSet_Parameters_default
    acctest.go:85: this resource does not currently ignore unconfigured CloudFormation template parameters with the Default property
--- SKIP: TestAccCloudFormationStackSet_Parameters_default (0.00s)
=== RUN   TestAccCloudFormationStackSet_Parameters_noEcho
    acctest.go:85: this resource does not currently ignore CloudFormation template parameters with the NoEcho property
--- SKIP: TestAccCloudFormationStackSet_Parameters_noEcho (0.00s)
=== RUN   TestAccCloudFormationStackSet_PermissionModel_serviceManaged
    acctest.go:85: API does not support enabling Organizations access (in particular, creating the Stack Sets IAM Service-Linked Role)
--- SKIP: TestAccCloudFormationStackSet_PermissionModel_serviceManaged (0.00s)
=== RUN   TestAccCloudFormationStackSet_tags
=== PAUSE TestAccCloudFormationStackSet_tags
=== RUN   TestAccCloudFormationStackSet_templateBody
=== PAUSE TestAccCloudFormationStackSet_templateBody
=== RUN   TestAccCloudFormationStackSet_templateURL
=== PAUSE TestAccCloudFormationStackSet_templateURL
=== CONT  TestAccCloudFormationStackSetInstance_basic
=== CONT  TestAccCloudFormationStackSet_administrationRoleARN
--- PASS: TestAccCloudFormationStackSet_administrationRoleARN (86.75s)
=== CONT  TestAccCloudFormationStackSetInstance_deploymentTargets
    acctest.go:954: this AWS account must be the management account of an AWS Organization
--- SKIP: TestAccCloudFormationStackSetInstance_deploymentTargets (0.77s)
=== CONT  TestAccCloudFormationStackSet_disappears
--- PASS: TestAccCloudFormationStackSetInstance_basic (102.58s)
=== CONT  TestAccCloudFormationStackSet_basic
--- PASS: TestAccCloudFormationStackSet_disappears (40.36s)
=== CONT  TestAccCloudFormationStackSetInstance_operationPreferences
    acctest.go:954: this AWS account must be the management account of an AWS Organization
--- SKIP: TestAccCloudFormationStackSetInstance_operationPreferences (1.02s)
=== CONT  TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
    acctest.go:954: this AWS account must be the management account of an AWS Organization
--- SKIP: TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU (1.51s)
=== CONT  TestAccCloudFormationStackSetInstance_parameterOverrides
--- PASS: TestAccCloudFormationStackSet_basic (54.64s)
=== CONT  TestAccCloudFormationStackSetInstance_retainStack
--- PASS: TestAccCloudFormationStackSetInstance_parameterOverrides (218.26s)
=== CONT  TestAccCloudFormationStackSet_templateBody
--- PASS: TestAccCloudFormationStackSetInstance_retainStack (212.63s)
=== CONT  TestAccCloudFormationStackSet_templateURL
--- PASS: TestAccCloudFormationStackSet_templateBody (87.57s)
=== CONT  TestAccCloudFormationStackSet_tags
--- PASS: TestAccCloudFormationStackSet_templateURL (100.78s)
=== CONT  TestAccCloudFormationStackSet_managedExecution
--- PASS: TestAccCloudFormationStackSet_managedExecution (45.92s)
=== CONT  TestAccCloudFormationStackSet_name
--- PASS: TestAccCloudFormationStackSet_tags (123.44s)
=== CONT  TestAccCloudFormationStackSet_operationPreferences
--- PASS: TestAccCloudFormationStackSet_name (87.13s)
=== CONT  TestAccCloudFormationStackSet_parameters
--- PASS: TestAccCloudFormationStackSet_parameters (160.88s)
=== CONT  TestAccCloudFormationStackSetInstance_Disappears_stackSet
--- PASS: TestAccCloudFormationStackSet_operationPreferences (247.02s)
=== CONT  TestAccCloudFormationStackSetInstance_disappears
--- PASS: TestAccCloudFormationStackSetInstance_Disappears_stackSet (83.75s)
=== CONT  TestAccCloudFormationStackSet_description
--- PASS: TestAccCloudFormationStackSetInstance_disappears (117.02s)
=== CONT  TestAccCloudFormationStackSet_executionRoleName
--- PASS: TestAccCloudFormationStackSet_description (83.72s)
--- PASS: TestAccCloudFormationStackSet_executionRoleName (84.72s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cloudformation	1014.601s
% make testacc TESTARGS='-run=TestAccCloudFormationStackSet_autoDeployment' PKG=cloudformation
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/cloudformation/... -v -count 1 -parallel 20  -run=TestAccCloudFormationStackSet_autoDeployment -timeout 180m
=== RUN   TestAccCloudFormationStackSet_autoDeploymentEnabled
=== PAUSE TestAccCloudFormationStackSet_autoDeploymentEnabled
=== RUN   TestAccCloudFormationStackSet_autoDeploymentDisabled
=== PAUSE TestAccCloudFormationStackSet_autoDeploymentDisabled
=== CONT  TestAccCloudFormationStackSet_autoDeploymentEnabled
=== CONT  TestAccCloudFormationStackSet_autoDeploymentDisabled
--- PASS: TestAccCloudFormationStackSet_autoDeploymentEnabled (50.60s)
--- PASS: TestAccCloudFormationStackSet_autoDeploymentDisabled (50.60s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cloudformation	56.573s
% make testacc TESTARGS='-run=TestAccCloudFormationStackSetInstance_deploymentTargets\|TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU' PKG=cloudformation
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/cloudformation/... -v -count 1 -parallel 20  -run=TestAccCloudFormationStackSetInstance_deploymentTargets\|TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU -timeout 180m
=== RUN   TestAccCloudFormationStackSetInstance_deploymentTargets
=== PAUSE TestAccCloudFormationStackSetInstance_deploymentTargets
=== RUN   TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== PAUSE TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== CONT  TestAccCloudFormationStackSetInstance_deploymentTargets
=== CONT  TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
--- PASS: TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU (104.28s)
--- PASS: TestAccCloudFormationStackSetInstance_deploymentTargets (230.26s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cloudformation	236.246s

@ewbankkit
Copy link
Contributor

@Steffen911 Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 2145a43 into hashicorp:main Aug 31, 2023
41 checks passed
@github-actions github-actions bot added this to the v5.15.0 milestone Aug 31, 2023
This was referenced Aug 31, 2023
@github-actions
Copy link

github-actions bot commented Sep 1, 2023

This functionality has been released in v5.15.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!

@Steffen911 Steffen911 deleted the b-aws_cloudformation_stack_set_auto_deployment-19015 branch September 4, 2023 08:19
@github-actions
Copy link

github-actions bot commented Oct 5, 2023

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 Oct 5, 2023
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. documentation Introduces or discusses updates to documentation. service/cloudformation Issues and PRs that pertain to the cloudformation 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
4 participants