AWS cdk documentation change
Summary
Added detailed documentation about CDK CLI diff output symbols and provided an example of a Lambda function diff.
Security assessment
The changes are purely about improving documentation for the CDK CLI diff command and its output format. There is no security-related content in these changes.
Diff
diff --git a/cdk/v2/guide/ref-cli-cmd-diff.md index c5315f2db..4480e3e90 100644 --- a/cdk/v2/guide/ref-cli-cmd-diff.md +++ b/cdk/v2/guide/ref-cli-cmd-diff.md @@ -104,0 +105,52 @@ The path to the CloudFormation template to compare a CDK stack with. +The CDK CLI uses the following symbols in the diff output: + + * `[+]` – Identifies code or resources that will be added if you deploy your changes. + + * `[-]` – Identifies code or resources that will be removed if you deploy your changes. + + * `[~]` – Identifies a resource or property that will be modified if you deploy your changes. + + + + +The following is an example that shows a diff of local changes to a Lambda function: + + + $ cdk diff MyStackName + start: Building asset-hash:account-Region + success: Built asset-hash:account-Region + start: Publishing asset-hash:account-Region + success: Published asset-hash:account-Region + Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff) + Stack MyStackName + Resources + [~] AWS::Lambda::Function HelloWorldFunction resource-logical-ID + └─ [~] Code + └─ [~] .ZipFile: + ├─ [-] + exports.handler = async function(event) { + return { + statusCode: 200, + body: JSON.stringify('Hello World!'), + }; + }; + + └─ [+] + exports.handler = async function(event) { + return { + statusCode: 200, + body: JSON.stringify('Hello from CDK!'), + }; + }; + + + + ✨ Number of stacks with differences: 1 + +A `[~]` indicator for resources that will be modified does not always mean a full resource replacement: + + * Some resource properties, like `Code`, will update the resource. + + * Some resource properties, like `FunctionName`, may cause a full resource replacement. + + @@ -106 +157,0 @@ The path to the CloudFormation template to compare a CDK stack with. - $ cdk diff MyStackName --app='node bin/main.js'