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

[Bug]: Issue with multiple aws_cloudformation_stack_instances resources on the same aws_cloudformation_stack_set, but with different regions or OUs #40243

Open
JorisBoelen-TomTom opened this issue Nov 21, 2024 · 1 comment
Labels
bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/cloudformation Issues and PRs that pertain to the cloudformation service.

Comments

@JorisBoelen-TomTom
Copy link

Terraform Core Version

1.9.8

AWS Provider Version

5.76.0

Affected Resource(s)

  • aws_cloudformation_stack_instances

Expected Behavior

When deploying multiple aws_cloudformation_stack_instances resources that point to the same aws_cloudformation_stack_set, but have a different value for the parameter regions or organizational_unit_ids, I would expect the resources to only require an update if the value changes, not on each terraform plan/apply

Use case is to deploy a Cloud Formation StackSet to only 1 region for certain accounts, but to multiple regions for other accounts.

Or to deploy a StackSet to all accounts in 1 OU, and only to a limited set of accounts in another OU.

It's not clear to me whether this is a bug, a limitations from AWS or a misunderstand from my side.

Actual Behavior

Initially the resources are created correctly. But on every terraform plan/apply it marks the regions or organizational_unit_ids parameters as being modified, requiring an update of the resource.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

Example 1: multiple aws_cloudformation_stack_instances resources, but for different regions.

resource "aws_cloudformation_stack_set" "this" {
  name                    = var.cloudformation_stack_set_name
  ...
}

resource "aws_cloudformation_stack_instances" "one" {
  stack_set_name = aws_cloudformation_stack_set.this.name
  regions                = ["eu-west-1"]
  ...
}

resource "aws_cloudformation_stack_instances" "two" {
  stack_set_name = aws_cloudformation_stack_set.this.name
  regions                = ["eu-west-1", "eu-central-1"]
}

Example 2: multiple aws_cloudformation_stack_instances resources, but for different OUs.

resource "aws_cloudformation_stack_set" "this" {
  name                    = var.cloudformation_stack_set_name
  ...
}

resource "aws_cloudformation_stack_instances" "one" {
  stack_set_name = aws_cloudformation_stack_set.this.name
  regions                = ["eu-west-1" "eu-central-1"]

  deployment_targets {
    organizational_unit_ids = ["ou-1234"]
  }
  ...
}

resource "aws_cloudformation_stack_instances" "two" {
  stack_set_name = aws_cloudformation_stack_set.this.name
  regions                = ["eu-west-1", "eu-central-1"]

  deployment_targets {
    organizational_unit_ids = ["ou-1235"]
    account_filter_type = "DIFFERENCE"
    accounts = ["1111111", "222222"]
  }
}

Steps to Reproduce

  • Create terraform configuration file as above snippet
  • Run terraform apply
  • Do not modify the files
  • Run terraform apply again, updates are needed to resources

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@JorisBoelen-TomTom JorisBoelen-TomTom added the bug Addresses a defect in current functionality. label Nov 21, 2024
@github-actions github-actions bot added the service/cloudformation Issues and PRs that pertain to the cloudformation service. label Nov 21, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/cloudformation Issues and PRs that pertain to the cloudformation service.
Projects
None yet
Development

No branches or pull requests

1 participant