(diff): Support Change Set Diffs for Nested Stacks #28568
Labels
@aws-cdk/core
Related to core CDK functionality
cli
Issues related to the CDK CLI
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p1
Describe the feature
#28336 causes diff to create and analyze a change set to more accurately determine resource replacements. This does not support nested stacks, because #18207 inlined the nested templates into the root stack template under a special property,
NestedTemplate
. When we send this modified root stack template throughCreateChangeSet
, CFN throwsTemplate Error: Fn::Equals cannot be partially collapsed
, because the nested template includes the CDK Metadata condition (which usesFn::Equals
) in theResources
section.Use Case
using
cdk diff
with nested stacks.Proposed Solution
In the toolkit, realize that the template has nested stacks and that we want to create a change set. If so, do not call
readCurrentTemplateWithNestedStacks(stack)
, since this mutates thestack
to include the nested templates. Instead, callreadCurrentTemplate(stack)
, which mutates thestack
to only include the root stack template. Then, upload the body parameters to S3 for each nested stack (so CFN can find the updated templates forCreateChangeSet
) and use each nested change set fromDescribeChangeSet()
in a similar way that #28336 does to determine resource replacement across the nested stacks.Other Information
No response
Acknowledgements
CDK version used
latest
Environment details (OS name and version, etc.)
all
The text was updated successfully, but these errors were encountered: