Skip to content

[Bug]: Terraform doesn't detect change when an OU as deployment target has been removed #41202

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

Open
bebold-jhr opened this issue Feb 3, 2025 · 1 comment
Labels
bug Addresses a defect in current functionality. service/cloudformation Issues and PRs that pertain to the cloudformation service.

Comments

@bebold-jhr
Copy link

Terraform Core Version

1.9.x

AWS Provider Version

5.84.0

Affected Resource(s)

  • aws_cloudformation_stack_set_instance

Expected Behavior

Terraform detects that an organizational unit has been removed from organizational_unit_ids in the deployment_targets block and acts accordingly. Probably will result in a replace (destroy + create).

Actual Behavior

No changes detected.

Relevant Error/Panic Output Snippet

Terraform Configuration Files

resource "aws_cloudformation_stack_set" "####" {
  depends_on = [
    aws_organizations_organization.this,
  ]

  name             = "####"
  permission_model = "SERVICE_MANAGED"

  auto_deployment {
    enabled                          = true
    retain_stacks_on_account_removal = false
  }

  managed_execution {
    active = false
  }

  operation_preferences {
    max_concurrent_percentage    = 100
    failure_tolerance_percentage = 100
    region_concurrency_type      = "PARALLEL"
  }

  capabilities = ["CAPABILITY_NAMED_IAM"]

  parameters = {
    #### = ####
  }

  template_body = file("####.yml")

  lifecycle {
    ignore_changes = [administration_role_arn]
  }
}

resource "aws_cloudformation_stack_set_instance" "####" {
  stack_set_name = aws_cloudformation_stack_set.####.name
  retain_stack   = false
  call_as        = "SELF"

  deployment_targets {
    organizational_unit_ids = [
      aws_organizations_organizational_unit.####.id, // OU 1
      // aws_organizations_organizational_unit.####.id, // OU 2
    ]
  }

  operation_preferences {
    max_concurrent_percentage    = 100
    failure_tolerance_percentage = 100
    region_concurrency_type      = "PARALLEL"
  }
}

Steps to Reproduce

  • Create the StackSet using the code snippet and a single OU in aws_cloudformation_stack_set_instance => deployment_targets.organizational_unit_ids
  • Terraform apply
  • Add a second OU
  • Terraform apply
  • Remove the second OU again
  • Terraform plan

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@bebold-jhr bebold-jhr added the bug Addresses a defect in current functionality. label Feb 3, 2025
Copy link

github-actions bot commented Feb 3, 2025

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 service/cloudformation Issues and PRs that pertain to the cloudformation service. needs-triage Waiting for first response or review from a maintainer. labels Feb 3, 2025
@bebold-jhr bebold-jhr changed the title [Bug]: Terraform doesn't detect change when a deployment target has been removed [Bug]: Terraform doesn't detect change when a OU as deployment target has been removed Feb 3, 2025
@bebold-jhr bebold-jhr changed the title [Bug]: Terraform doesn't detect change when a OU as deployment target has been removed [Bug]: Terraform doesn't detect change when an OU as deployment target has been removed Feb 3, 2025
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Feb 3, 2025
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. service/cloudformation Issues and PRs that pertain to the cloudformation service.
Projects
None yet
Development

No branches or pull requests

2 participants