aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

aws-cdk: Add --except flag in CDK CLI

Open badaldavda8 opened this issue 1 year ago • 3 comments

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 -

  1. I create VPC, Elastic Beanstalk.
  2. This elastic beanstalk creates an internal ALB.
  3. I need a privatelink connectivity to this internal ALB so I create an NLB in another stack.
  4. To reference the ALB created, we need to get information like VPC of the ALB etc to create NLB in.
  5. We use fromLookup with Beanstalk Env name/tag to do that (since Beanstalk does not provide output for Load Balancer properties).
  6. 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

badaldavda8 avatar Oct 16 '23 11:10 badaldavda8

Thank you. Please help us prioritize with the upvotes 👍

pahud avatar Oct 17 '23 16:10 pahud

+1

nkhandelwal1 avatar May 09 '24 08:05 nkhandelwal1

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.

github-actions[bot] avatar Jul 14 '24 00:07 github-actions[bot]

+1

crawfobw avatar Sep 12 '24 00:09 crawfobw

+1

fahadjanjua-kmart avatar Sep 18 '24 02:09 fahadjanjua-kmart