Repository navigation
Diff: Minimise IAM changes #35900
Replies: 2 comments 1 reply
|
Hi @EHadoux! This happens because AWS CDK's IAM policy synthesizer performs automatic statement minification: when multiple policy statements share the exact same When CloudFormation diffs the synthesized template, it sees a modification of the statement's Here are the 3 clean ways to prevent this compaction and ensure Solution 1: Assign Explicit Statement IDs (
|
|
Hello! Reopening this discussion to make it searchable. |

Hi @EHadoux! This happens because AWS CDK's IAM policy synthesizer performs automatic statement minification: when multiple policy statements share the exact same
ActionandEffect, CDK merges theirResourcearrays into a single statement to conserve IAM policy size limits.When CloudFormation diffs the synthesized template, it sees a modification of the statement's
Resourceproperty, whichcdk diffrenders as a removal of the single-string resource and an addition of the combined array.Here are the 3 clean ways to prevent this compaction and ensure
cdk diffshows only green additions:Solution 1: Assign Explicit Statement IDs (
sid) (Recommended)CDK's IAM deduplication pass will never …