Files
floci/docs
Alessandro Lattao 197ccb5fb7 fix(cloudformation): refuse an update that has nothing to change (#5849)
* fix(cloudformation): refuse an update that has nothing to change

UpdateStack ran a full update for a stack resubmitted as it was, ending
UPDATE_COMPLETE, and CreateChangeSet created an AVAILABLE change set for
it. CloudFormation refuses the update with "No updates are to be
performed." and creates the change set FAILED, UNAVAILABLE, with "The
submitted information didn't contain changes. Submit different
information to create a change set."; the CDK and aws cloudformation
deploy read that reason as "no changes".

What CloudFormation compares was measured in eu-west-1: each active
resource's Type, Properties, Metadata, DeletionPolicy, UpdateReplacePolicy
and UpdatePolicy, and each active output's Value, Description and Export,
with whatever does not depend on a resource resolved first, and the tags
as a set (absent Tags keep the stack's). ComparedTemplate brings a
template to that form: a new Description, an unused parameter, a
DependsOn or a literal written as Fn::Join is no change, while a used
mapping value, a Ref of a resource rewritten as Fn::Sub, or a dynamic
reference whose stored value moved is one. Templates are compared as
processed, AWS::Include fragments read again and the SAM transform
applied with the stack's parameter values, and a stack with a nested
stack is always updated. The change set diff uses the same form.

The CDK deletes the FAILED change set and deletes it again by name
before its next deploy, so DeleteChangeSet now answers success for a
change set the stack does not have, as CloudFormation does. A stack set
instance whose stack has nothing to change is left as it is. Tests that
resubmitted an identical template to exercise an update add an output
through CfnUpdates.forceUpdate, which is an update on AWS too.

* fix(cloudformation): record dynamic reference values when an operation commits

Answers the review of #5849.

The value each dynamic reference resolved to is now recorded when the
stack's operation commits, from the template the stack then has and
keyed as ComparedTemplate hands the references over, instead of while
the engine provisioned each resource. Recording and comparison so see
the same strings, an Fn::Sub that also reads a resource included; an
update that fails and rolls back records nothing and keeps the last
deployment's values; a reference the template dropped is dropped; and
AWS::RDS::DBInstance's master credentials, which its provisioner
resolves itself with ssm-secure, are compared like any other reference.
The values are kept as an HMAC-SHA256 under a random key of the stack's
own rather than a bare SHA-256.

ComparedTemplate keeps an AWS::NoValue inside a function it compares as
written, and gives the array form of Fn::Sub the static variable
substitution the string form has, its own variables left as written.

A stack set instance with nothing to change succeeds whatever status an
earlier rolled-back update left its stack in, and the change set that
found it so is deleted. DeleteChangeSet by a change set's ARN alone
succeeds when the change set is gone, as measured on CloudFormation in
eu-west-1 on 2026-10-17.

The comparison now catches only what it can meet: a template that does
not parse, and the AwsException an AWS::Include, the SAM transform or an
SSM parameter raises, which the update itself then reports.
2026-10-16 21:53:03 -04:00
..
2026-03-15 17:43:56 -05:00