Skip to content

feat(cli): support --change-set-name for cdk diff - #1982

Open
mrgrain wants to merge 1 commit into
mainfrom
mrgrain/feat/cli/diff-change-set-name
Open

mrgrain wants to merge 1 commit into
mainfrom
mrgrain/feat/cli/diff-change-set-name

Conversation

@mrgrain

@mrgrain mrgrain commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

cdk deploy, cdk watch, and cdk import all accept --change-set-name, but cdk diff always creates its change set with the hardcoded name cdk-diff-change-set. In automated environments where multiple diffs can run against the same stack, or where change set names are used for auditing, callers need to control that name — same motivation that added the flag to deploy in the first place.

This adds a changeSetName option to toolkit-lib's ChangeSetDiffOptions and plumbs it through to createDiffChangeSet, keeping cdk-diff-change-set as the default so existing behavior is unchanged. The CLI exposes it as --change-set-name on cdk diff, and rejects the combination with --method=template (where no change set is created), consistent with deploy rejecting it for --method=direct. createValidationChangeSet explicitly Omits the new option, since the validation change set used by cdk diagnose derives its name from a per-run UUID.

Verified with new unit tests in both packages (custom name reaches CreateChangeSetCommand; CLI passes the flag through and rejects incompatible methods) plus full green builds including the toolkit-lib API Extractor check.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Deploy, watch, and import already accept --change-set-name, but diff
always creates its change set with the hardcoded name
'cdk-diff-change-set'.

Add a changeSetName option to toolkit-lib's ChangeSetDiffOptions and
plumb it through to createDiffChangeSet, keeping the existing name as
the default. Expose it as --change-set-name on cdk diff, rejected when
combined with --method=template (consistent with deploy rejecting it
for --method=direct).
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@mrgrain
mrgrain deployed to no-approval September 21, 2026 13:44 — with GitHub Actions Active
@aws-cdk-automation
aws-cdk-automation requested a review from a team September 21, 2026 13:44
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.31%. Comparing base (8904fc5) to head (6b117a4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1982      +/-   ##
==========================================
- Coverage   91.32%   91.31%   -0.02%     
==========================================
  Files          79       79              
  Lines       12215    12233      +18     
  Branches     1724     1725       +1     
==========================================
+ Hits        11155    11170      +15     
- Misses       1025     1027       +2     
- Partials       35       36       +1     
Flag Coverage Δ
suite.unit 91.31% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rix0rrr

rix0rrr commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Shouldn't we also switch to cdk-diff-change-set-${uuid()} by default, to solve the 99% case automatically?

@rix0rrr rix0rrr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also switch to cdk-diff-change-set-${uuid()} by default, to solve the 99% case automatically?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants