1

If I have an existing CloudFormation stack with some resources that are always active, and some that are not always active (i.e., resources that have a Condition that is evaluating to false), and I attempt to update the template of ONLY those inactive resources without activating them (i.e., their Condition is still evaluating to false) via the CLI or API, I get a No updates are to be performed. error:

aws cloudformation update-stack --stack-name <name> --template-body "..."

An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed.

If I then check the Stack Template, it has the previous template, not the new one.

However, if I do what is essentially the same thing but from the AWS Console (i.e., Update Stack -> Replace current template -> Upload a template file -> No other changes), the template will be updated.

Is there some way to accomplish such a template update via CLI or API?

1 Answers1

0

Edit: This doesn't work. When using the console CloudTrail logs the API call as UpdateStack, but using the same parameters in the CLI command doesn't seem to work.


Instead of aws cloudformation update-stack you can use aws cloudformation deploy --no-fail-on-empty-changeset.

References:

Kaustubh Khavnekar
  • 2,553
  • 2
  • 14
  • Ah, so I should create a change set and then deploy it with this option? Thanks! – Chris Philips Feb 04 '22 at 18:21
  • Followup - this does not accomplish what I was asking for. The `--no-fail-on-empty-changeset` option only makes the CLI return an exit code of `0` if the changeset fails due to an empty changeset. It will not update the template unless active resources are also changed. – Chris Philips Feb 08 '22 at 06:02
  • @ChrisPhilips Yes you are right, I updated my answer with a note that it does not work. I should have tried it myself instead of just looking at the docs. Interestingly, for the successful Console updates, CloudTrail logs the API call as UpdateStack, even though the CLI command does not work. – Kaustubh Khavnekar Feb 18 '22 at 17:50