[Bug]: aws_cloudformation_stack_set_instance operation error when targeting OU #40675
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.
Terraform Core Version
1.9.8
AWS Provider Version
5.82.2
Affected Resource(s)
Expected Behavior
When updating parameters in the resource with deployment_targets set to an OU rather than an account, it should succeed to update.
Actual Behavior
If
deployment_targets
is set only to an OU and not an account, there is a validation error as the provider is sending the OU ID through as an account ID.Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
operation_preferences
section of thestack_set_instance
terraform apply
to create the stack set and stack set instanceoperation_preferences
(or make any other change to thestack_set_instance
)terraform apply
Debug Output
No response
Panic Output
No response
Important Factoids
This appears to be an issue with the resourceStackSetInstanceUpdate function in the code, as the only option is to pass in
Accounts
: https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/cloudformation/stack_set_instance.go#L418-L424The value getting passed into accounts is being pulled from the resource ID, but if you target an OU or two, the resource ID does not have an account in it.
Based on the golang spec, it appears that simply changing from
Accounts
to DeploymentTargets should suffice.Part of me wonders if there is a larger issue with how the resource ID is being created and used to figure out the targets, as it assumes that there will only ever be 1 value passed into the input, but if more than one account or OU is provided, the object includes them
/
separated, but the input validation does not split them back into a list.References
No response
Would you like to implement a fix?
Yes
The text was updated successfully, but these errors were encountered: