You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose I've deployed the stack set, and this has deployed a stackset's instance into the ACCOUNT A (i.e. inside the account A there's the bucket defined in the CloudFormation template.
Now suppose I want to add a second target for this stackset (i.e. the account B) and consider that CloudFormation template is exactly the same.
I expect that Stackset operation ignores ACCOUNT A and only deploys the S3 bucket into the new target.
Actual Behavior
Alas, the actual behaviour is different. The instance of Account A is attempting to be deleted and so the S3; but since the bucket contains a file (view the Steps to reproduce section), it can't be destroyed and here is where everything falls apart.
Error: waiting for CloudFormation StackSet Instance (test-intersection-stack-set,,) delete: unexpected state 'FAILED', wanted target 'SUCCEEDED'. last error: Account (), Region (), FAILED: ResourceLogicalId:TerraformInitBucket, ResourceType:AWS::S3::Bucket, ResourceStatusReason:Resource handler returned message: "The bucket you tried to delete is not empty (Service: S3, Status Code: 409, Request ID: 56E...NGK, Extended Request ID: kdmOclPVRZdHa...kCEc=)" (RequestToken: bc2c5XXXX757f1f9, HandlerErrorCode: GeneralServiceException).
Steps to Reproduce
To reproduce this behaviour you need:
the id of an organizational unit (OU);
a management account in which to deploy the stackset;
two accounts, part of the above organization, in which you want to target the stack set instances;
Once you have this information, you have to proceed in three stages.
Stage 1
Deploy the stack set and its first instance. To do this, you have to fill in these local parameters in your main.tf:
root_ou_id = "<ID OF MY ROOT OU>"
accounts_ids = [
"<ID OF ACCOUNT A>",
# "<ID OF ACCOUNT B>"
]
region = "<MY REGION>"
It is important to notice that we are only targeting ACCOUNT A (ACCOUNT B, as you can see, is commented out).
At this point, you can run:
terraform init
terraform plan -out=tfplan
terraform apply tfplan
Stage 2
Go into ACCOUNT A, search for the newly created bucket and upload a random file in it.
Stage 3
Uncomment ACCOUNT B from your locals, so your main.tf will look like this:
root_ou_id = "<ID OF MY ROOT OU>"
accounts_ids = [
"<ID OF ACCOUNT A>",
"<ID OF ACCOUNT B>"
]
region = "<MY REGION>"
then
terraform plan -out=tfplan
terraform apply tfplan
and the error should appear.
Additional Context
I have tried the same steps using the Cloudformation console and this problem never arose, so I thought it could be a bug somewhere.
References
No response
Generative AI / LLM assisted development?
No response
The text was updated successfully, but these errors were encountered:
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Terraform Version
Terraform Configuration Files
There are two small files in this issue:
This is the first one
main.tf
:and this is the second one
stackset.yml
Debug Output
I can't post the output for internal policy.
Expected Behavior
Suppose I've deployed the stack set, and this has deployed a stackset's instance into the ACCOUNT A (i.e. inside the account A there's the bucket defined in the CloudFormation template.
Now suppose I want to add a second target for this stackset (i.e. the account B) and consider that CloudFormation template is exactly the same.
I expect that Stackset operation ignores ACCOUNT A and only deploys the S3 bucket into the new target.
Actual Behavior
Alas, the actual behaviour is different. The instance of Account A is attempting to be deleted and so the S3; but since the bucket contains a file (view the Steps to reproduce section), it can't be destroyed and here is where everything falls apart.
Steps to Reproduce
To reproduce this behaviour you need:
Once you have this information, you have to proceed in three stages.
Stage 1
Deploy the stack set and its first instance. To do this, you have to fill in these local parameters in your main.tf:
It is important to notice that we are only targeting ACCOUNT A (ACCOUNT B, as you can see, is commented out).
At this point, you can run:
Stage 2
Go into ACCOUNT A, search for the newly created bucket and upload a random file in it.
Stage 3
Uncomment ACCOUNT B from your locals, so your main.tf will look like this:
then
and the error should appear.
Additional Context
I have tried the same steps using the Cloudformation console and this problem never arose, so I thought it could be a bug somewhere.
References
No response
Generative AI / LLM assisted development?
No response
The text was updated successfully, but these errors were encountered: