Delete nested CloudFormation stack's Changeset

0

Tried applying a change to a nested CloudFormation stack but have now got an issue with the nested Changesets.

Ran a Changeset request against the root CloudFormation script and this reported that the Changeset creation was completed successfully and could be executed. I, therefore, initiated execution of the Changeset which appeared to complete without issue. However, when checking the nested CloudFormation stacks they all show a Status of Failed and the Status reason as being there were no changes. While this is true for 2/3 of the nested stacks, one should have had a change. The problem now is that I can't delete the nested Changesets as the root Changeset has been executed. How do I remove the Failed Changesets as they are still listed under Changesets and when selected neither the Delete changeset or *Execute changeset *options are available?

asked a month ago100 views
1 Answer
0

Hi Glenn,

To create a Changeset for the entire stack hierarchy, including the nested stacks, you need to use the
--include-nested-stacks
parameter when running the
create-change-set
command in the AWS CLI. This ensures that the Changesets for the nested stacks are also created and can be executed.

Example AWS CLI command:

aws cloudformation create-change-set 
 --stack-name my-root-stack
 --change-set-name my-root-stack-change-set
 --template-body file://template.yaml
 --capabilities CAPABILITY_IAM
 --include-nested-stacks

After the Changeset is created, you can execute it using the
execute-change-set
command. This will apply the changes to the entire stack hierarchy, including the nested stacks.

Example AWS CLI command:

aws cloudformation execute-change-set
 --stack-name my-root-stack
 --change-set-name my-root-stack-change-set

If you are still unable to delete the failed Changesets for the nested stacks, you can try the following:
    Use the
    describe-change-set
    command to get more details about the failed Changesets.
    If the Changesets are still in a "Failed" state, you may need to wait for some time before they can be deleted.
    As a last resort, you can try deleting the entire stack and recreating it with the updated template.
AWS
AWS TAM
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • Thanks for the comment, though it hasn't helped resolve the issue. Indeed, highlighting the describe-change-set command confirms that the Failed nested changeset points to a parent/root changeset that no longer exists because it successfully executed, i.e. "ExecutionStatus": "EXECUTE_COMPLETE". It has, however, appeared to help confirm there is a bug with AWS when dealing with nested CloudFormation templates in that if nested templates don't actually have any changes they end-up in a hung state, i.e. neither executing because there are no changes nor being deleted/removed when the parent/root script executes. Unfortunately my company does not have any Support Plan so can't raise this matter directly with AWS.