(cli): Ignore stacks from diff and deploy
- Dominant language
- TypeScript
- Stars
- 105
- Forks
- 122
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 71
Description
### Describe the feature
Add a flag to the CLI to allow not deploying certain stacks.
### Use Case
I maintain a large code-base which contains 669 stacks.
There currently is an issue with two of those stacks, which fail during deployment. A fix for those issues is complex and entails some risk. Due to the upcoming holiday season it was decided to postpone the fixing activities to mid of January.
So right now, I could not run a full `cdk deploy` as those two stacks would fail.
Those two stacks consume exports from other stacks. So if I were to temporarily remove them from the code-base, CDK would attempt to remove the exports from that other two stacks, causing them to fail.
These are automatically generated exports due to cross-region resource sharing. So adding exports manually to those other stacks doesn't really work. Those exports contain the names of the failing stacks in their IDs, so I also couldn't just create a dummy stack consuming those to keep those exports.
So currently. the only thing I can do is run `cdk deploy` with a list of all stacks, except the two broken ones. During compile-time, the broken stacks will still be there, so the exports will stay in place, they will just not be deployed.
This however is cumbersome and I would rather deploy all stacks as usual and exclude the broken ones.
### Proposed Solution
An option `--exclude-stack=` should be added to both `cdk diff` and `cdk deploy` which just skips those stacks.
The option could be specified multiple times if you want to exclude more than one stack.
If the `--all` option is used, the behavior is clearly defined.
If however, a list of stacks to be deployed is provided, I would say this flag should override that. This would allow things like:
`find -name prod-*.json | sed 's/\.json//' | xargs cdk deploy --exclude prod-broken-stack`
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.172.0 (build 0f666c5)
### Environment details (OS name and version, etc.)
Does not apply
Contributor guide
Assessment
This issue has not been assessed yet.