fix(cloudformation-diff): changeset-based diff hides static changes CloudFormation fails to detect - #1951
Merged
aws-cdk-automation merged 1 commit intoSep 8, 2026
Conversation
…loudFormation fails to detect
The changeset merger let an empty/silent changeset erase property changes
found by the template diff. CloudFormation changesets do not detect
exchanging one empty-object union member for another (e.g. a WAFv2 action
`{"Allow":{}}` -> `{"Block":{}}`), so `cdk diff` printed "There were no
differences" while `cdk deploy` applied the change.
The changeset may now only suppress a template-detected change when the
property contains a deploy-time value (Ref, Fn::*, or a dynamic
reference); purely static differences are always kept.
mrgrain
force-pushed
the
mrgrain/fix/cloudformation-diff/changeset-hides-static-changes
branch
from
September 7, 2026 17:11
053f3f5 to
35910c3
Compare
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1951 +/- ##
=======================================
Coverage 91.33% 91.33%
=======================================
Files 79 79
Lines 12164 12164
Branches 1721 1721
=======================================
Hits 11110 11110
Misses 1019 1019
Partials 35 35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rix0rrr
approved these changes
Sep 8, 2026
aws-cdk-automation
deleted the
mrgrain/fix/cloudformation-diff/changeset-hides-static-changes
branch
September 8, 2026 08:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cdk diffreported "There were no differences" for changes CloudFormation changesets fail to detect, whilecdk deploystill applied them. The reported case is a WAFv2 WebACL where an action switches from{"Allow":{}}to{"Block":{}}: exchanging one empty-object union member for another is invisible to CloudFormation's changeset engine. Verified against real CloudFormation — the changeset completes with an emptyChangeslist for exactly this update (reproduced with both CLOUDFRONT and REGIONAL scope, forDefaultActionandRules[].Action). An internal ticket has been filed with the CloudFormation team for the underlying detection gap.The template diff detects the change correctly, but the changeset merger then discards it: any template-detected property change that the changeset does not mention was overridden to "no change". That veto exists so the changeset can silence false positives on deploy-time values (e.g. an SSM-parameter-driven name that resolves to the same value, see #641) — but for a purely static difference the changeset has no better knowledge than the template, and its silence only means it failed to detect the change.
The merger now checks what kind of value changed before letting the changeset suppress it. If either side of the difference contains a deploy-time construct (
Ref, anFn::*intrinsic, or a{{resolve:...}}dynamic reference), the changeset verdict wins as before. A static difference is always kept. Unit tests that encoded the old blanket suppression were updated accordingly, and a regression test replays the WAF scenario against the empty changeset observed from the real service.A new integration test deploys a WebACL from a dedicated
waf-appfixture, flips the action, and assertscdk diff --method=change-setsurfaces the change (verified passing against a real account). Following recent guidance, the fixture is a standalone app rather than an addition to the shared default app; a note codifying that preference was added to AGENTS.md.Fixes #1922
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license