I have a CDK project where we wrap all our resources in the Pipeline construct. Prior to adding the pipeline, we could run cdk diff locally to view changes to the resources we were deploying. Now that we use the Pipeline construct, running diff's locally only results in changes to the pipeline construct being displayed. Is there any way other fiddling with the pipeline construct to view diff's of the application resources and not the pipeline?
CodePudding user response:
Option 1: diff the Application resources AND the Pipeline resources
The stack specifier **
will return differences for all stacks in the hierarchy, not just the Pipeline itself:
cdk diff '**' -a 'ts-node ./bin/app-pipeline.ts'
Option 2: diff the Application resources only
To exclude differences in your Pipeline stack entirely, first nest the "application' stacks in a new Construct
subclass. See CDK doc's MyService
construct example. MyService
wraps three child "application" stacks:
MyService # Construct
ControlPlane # Stack
DataPlane # Stack
Monitoring # Stack
Then use MyService
in two contexts, your pipeline Stage and App:
# app-pipeline.ts
MyPipeline # Pipeline
MyStage # Stage
MyService # Construct
# app.ts
App # App
MyService # Construct
Running cdk diff --app 'ts-node ./bin/app.ts'
on the App will generate the differences in ControlPlane
, DataPlane
and Monitoring
, not the pipeline itself. These are the same Application differences that will be deployed in the pipeline.