aws-cdk
aws-cdk copied to clipboard
aws-cdk: Add --except flag in CDK CLI
Describe the feature
cdk diff, cdk synth, cdk deploy all have option either to deploy all or deploy specific stack.
There must be an option where I do a cdk diff --except abc-stack where it does a diff for all the stacks except abc-stack.
Use Case
When you create cdk during ci/cd pipeline, there might be situations where you will first create 4 stacks and 1 stack will be dependent on the output of those 4 stacks created which we might reference resources.
Example, in my case -
- I create VPC, Elastic Beanstalk.
- This elastic beanstalk creates an internal ALB.
- I need a privatelink connectivity to this internal ALB so I create an NLB in another stack.
- To reference the ALB created, we need to get information like VPC of the ALB etc to create NLB in.
- We use fromLookup with Beanstalk Env name/tag to do that (since Beanstalk does not provide output for Load Balancer properties).
- We also add ALB to NLBs Target Group which Requires ALB Construct.
In this case, if I do a diff during my first run, it will fail since my ALB with Beanstalk has not been created to populate the Context using fromLookup.
Proposed Solution
cdk diff --except abc-stack cdk deploy --except abc-stack cdk synth --except abc-stack
So either I create 2 stages where I do cdk diff --except nlb-stack and cdk deploy --except nlb-stack in 1st stage and cdk diff nlb-stack and cdk deploy nlb-stack in 2nd stage in my ci cd pipeline.
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.99.1
Environment details (OS name and version, etc.)
MacOS
Thank you. Please help us prioritize with the upvotes 👍
+1
This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.
+1
+1