Repository navigation
feat(cli): --no-include-nested-stacks option to create deploy change sets without nested stacks - #2195
Closed
DiegoOrtizS wants to merge 4 commits into
Closed
feat(cli): --no-include-nested-stacks option to create deploy change sets without nested stacks#2195DiegoOrtizS wants to merge 4 commits into
--no-include-nested-stacks option to create deploy change sets without nested stacks#2195DiegoOrtizS wants to merge 4 commits into
Conversation
…e sets without nested stacks Since aws#1531, deploy change sets are created with `IncludeNestedStacks: true`. For a large nested stack hierarchy, change set creation then fails with "Limit on the number of resources in a single stack operation exceeded". Add an `includeNestedStacks` option to `ChangeSetDeployment` in toolkit-lib (default `true`) and expose it on `cdk deploy` as `--[no-]include-nested-stacks` and as `includeNestedStacks` in `cdk.json`. Closes aws#2191 Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Pass the cdk.json setting to the follow-up deploy of `cdk import`. - Describe the quota error and the cost of opting out (late nested stack errors, nested stacks always reported as changed) in JSDoc, flag help and README, and say which commands the option affects. - Test --hotswap-fallback, cdk watch and cdk import; drop a test that repeated the default case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DiegoOrtizS
requested a deployment
to
integ-approval
December 2, 2026 17:36 — with
GitHub Actions
Waiting
aws-cdk-automation
enabled auto-merge
December 2, 2026 17:36
… quota error Testing showed that `--no-include-nested-stacks` does not avoid the 2,500 resources per operation quota: CloudFormation counts the resources that change in the deployment either way, and without nested change sets the failure only moves to execution, followed by a rollback. Remove the option again. Instead, explain the quota error when it shows up. The error is reported against the first nested stack that hit it, which reads like a problem with that stack. Add context saying the quota covers the whole deployment, counts changed resources, cannot be raised, and that the change must be split into smaller deployments. Closes aws#2191 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… sets Also align the hint with the wording of the CloudFormation quotas page, which does not say whether the quota can be raised. Co-Authored-By: Claude Opus 5.5 <[email protected]>
auto-merge was automatically disabled
December 2, 2026 18:18
Head branch was pushed to by a user without write access
DiegoOrtizS
requested a deployment
to
integ-approval
December 2, 2026 18:21 — with
GitHub Actions
Waiting
1 task
This branch is waiting to be deployed
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.
Closes #2191
Since #1531 (2.1124.0),
cdk deploycreates change sets withIncludeNestedStacks: true. For a large hierarchy (one root stack, ~30 nested stacks, 3,000+ resources), change set creation fails withLimit on the number of resources in a single stack operation exceeded. The workarounds are--method=direct(no change set review) or pinning the CLI below 2.1124.0, which also pinsaws-cdk-lib.This PR adds an opt-out with the pre-#1531 behavior:
ChangeSetDeployment.includeNestedStacks(defaulttrue). Whenfalse,IncludeNestedStacksis omitted, as for import and revert-drift change sets.cdk deploy --no-include-nested-stacks(change-set, prepare-change-set, hotswap fallback), or"includeNestedStacks": falseincdk.json, whichcdk watchand the follow-up deploy ofcdk importalso use. The flag wins overcdk.json.The default is unchanged.
Open question: I haven't confirmed yet that a root-only change set stays under the quota for the affected app. The quota page puts the 2,500 limit on the whole deployment, so if more than 2,500 resources really change, this only moves the failure to execution. I'll test this branch on the affected app and report back.
Design notes
cdk.jsoncan apply; toolkit-lib applies the default.cdk diffandcdk validate --onlineare out of scope;cdk diffalready falls back to a template diff.--method=director--method=execute-change-set. Documented rather than rejected, becauserejectIncompatibleOptionscan't tell the flag fromcdk.json.Testing: unit tests in toolkit-lib (
CreateChangeSetinput) and CLI (flag andcdk.jsonfor deploy, watch, import and hotswap fallback). Generated CLI files regenerated withscripts/user-input-gen.ts. Happy to add an integ test on thewith-nested-stackfixture.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
🤖 Generated with Claude Code