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_cloudformation_stack_set_instance: add support for additional deployment_targets config and refactor update deployment_targets config #37898

Conversation

yhamano0312
Copy link
Contributor

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

Description

resource/aws_cloudformation_stack_set_instance: Extend deployment_targets argument. Adding new argument for account_filter_type, accounts, and accounts_url.
ref: https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/cloudformation/types#DeploymentTargets

Additionally, fixing a bug that prevents updating the instance when the deployment_targets argument is updated. The original code executes the update-stack-instances API when changes are made to the deployment_targets argument. However, this API does not support updates to deployment_targets. Therefore, if there are updates to deployment_targets, the resource will be recreated. In PR #24523, the ForceNew difference was added to the deployment_targets argument, but it was necessary to add ForceNew to the arguments included in the deployment_targets setting in order to recreate.

Relations

Closes #27877
Closes #33785
Closes #25253
Closes #33914

Relates #26935
Relates #24523

References

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccCloudFormationStackSetInstance_' PKG=cloudformation ACCTEST_PARALLELISM=1
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/cloudformation/... -v -count 1 -parallel 1  -run=TestAccCloudFormationStackSetInstance_ -timeout 360m
=== 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_deploymentTargets
=== PAUSE TestAccCloudFormationStackSetInstance_deploymentTargets
=== RUN   TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== PAUSE TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== RUN   TestAccCloudFormationStackSetInstance_operationPreferences
=== PAUSE TestAccCloudFormationStackSetInstance_operationPreferences
=== RUN   TestAccCloudFormationStackSetInstance_delegatedAdministrator
=== PAUSE TestAccCloudFormationStackSetInstance_delegatedAdministrator
=== CONT  TestAccCloudFormationStackSetInstance_basic
--- PASS: TestAccCloudFormationStackSetInstance_basic (77.66s)
=== CONT  TestAccCloudFormationStackSetInstance_deploymentTargets
--- PASS: TestAccCloudFormationStackSetInstance_deploymentTargets (96.08s)
=== CONT  TestAccCloudFormationStackSetInstance_delegatedAdministrator
    stack_set_instance_test.go:339: skipping test because at least one environment variable of [AWS_ALTERNATE_PROFILE AWS_ALTERNATE_ACCESS_KEY_ID] must be set. Usage: credentials for running acceptance testing in alternate AWS account.
--- SKIP: TestAccCloudFormationStackSetInstance_delegatedAdministrator (0.19s)
=== CONT  TestAccCloudFormationStackSetInstance_operationPreferences
--- PASS: TestAccCloudFormationStackSetInstance_operationPreferences (90.31s)
=== CONT  TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
--- PASS: TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU (70.03s)
=== CONT  TestAccCloudFormationStackSetInstance_Disappears_stackSet
--- PASS: TestAccCloudFormationStackSetInstance_Disappears_stackSet (78.19s)
=== CONT  TestAccCloudFormationStackSetInstance_parameterOverrides
--- PASS: TestAccCloudFormationStackSetInstance_parameterOverrides (147.45s)
=== CONT  TestAccCloudFormationStackSetInstance_disappears
--- PASS: TestAccCloudFormationStackSetInstance_disappears (81.19s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cloudformation	645.222s
...

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/cloudformation Issues and PRs that pertain to the cloudformation service. labels Jun 10, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 10, 2024
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 @yhamano0312 👋

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 CONTRIBUTOR 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! 😃

@yhamano0312 yhamano0312 marked this pull request as ready for review June 10, 2024 13:04
@yhamano0312 yhamano0312 changed the title r/aws_cloudformation_stack_set_instance: add support for additional deployment_targets config and enabled update deployment_targets config r/aws_cloudformation_stack_set_instance: add support for additional deployment_targets config and refactor update deployment_targets config Jun 10, 2024
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 11, 2024
@nam054 nam054 requested a review from a team as a code owner July 2, 2024 19:13
Copy link
Contributor

@nam054 nam054 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: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.4 test ./internal/service/cloudformation/... -v -count 1 -parallel 20  -run=TestAccCloudFormationStackSetInstance_ -timeout 360m
=== 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_deploymentTargets
=== PAUSE TestAccCloudFormationStackSetInstance_deploymentTargets
=== RUN   TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== PAUSE TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== RUN   TestAccCloudFormationStackSetInstance_operationPreferences
=== PAUSE TestAccCloudFormationStackSetInstance_operationPreferences
=== RUN   TestAccCloudFormationStackSetInstance_delegatedAdministrator
=== PAUSE TestAccCloudFormationStackSetInstance_delegatedAdministrator
=== CONT  TestAccCloudFormationStackSetInstance_basic
=== CONT  TestAccCloudFormationStackSetInstance_deploymentTargets
=== CONT  TestAccCloudFormationStackSetInstance_operationPreferences
=== CONT  TestAccCloudFormationStackSetInstance_delegatedAdministrator
=== CONT  TestAccCloudFormationStackSetInstance_Disappears_stackSet
=== CONT  TestAccCloudFormationStackSetInstance_parameterOverrides
=== CONT  TestAccCloudFormationStackSetInstance_disappears
=== CONT  TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU
=== NAME  TestAccCloudFormationStackSetInstance_delegatedAdministrator
    stack_set_instance_test.go:339: skipping test because at least one environment variable of [AWS_ALTERNATE_PROFILE AWS_ALTERNATE_ACCESS_KEY_ID] must be set. Usage: credentials for running acceptance testing in alternate AWS account.
--- SKIP: TestAccCloudFormationStackSetInstance_delegatedAdministrator (0.87s)
--- PASS: TestAccCloudFormationStackSetInstance_DeploymentTargets_emptyOU (67.07s)
--- PASS: TestAccCloudFormationStackSetInstance_Disappears_stackSet (75.47s)
--- PASS: TestAccCloudFormationStackSetInstance_basic (77.58s)
--- PASS: TestAccCloudFormationStackSetInstance_disappears (83.23s)
--- PASS: TestAccCloudFormationStackSetInstance_operationPreferences (86.42s)
--- PASS: TestAccCloudFormationStackSetInstance_deploymentTargets (88.72s)
--- PASS: TestAccCloudFormationStackSetInstance_parameterOverrides (137.24s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/cloudformation     142.812s

@nam054 nam054 merged commit a486a44 into hashicorp:main Jul 5, 2024
44 checks passed
@nam054
Copy link
Contributor

nam054 commented Jul 5, 2024

Thank you for your contribution!

@github-actions github-actions bot added this to the v5.58.0 milestone Jul 5, 2024
@yhamano0312 yhamano0312 deleted the f-cfn-stacksetinstance-update-deployment-targets branch July 6, 2024 01:26
Copy link

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

Copy link

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 Aug 12, 2024
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. enhancement Requests to existing resources that expand the functionality or scope. service/cloudformation Issues and PRs that pertain to the cloudformation service. size/M 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
3 participants