Skip to content

(pipelines): view cdk diff output in CodePipeline #12273

@blimmer

Description

@blimmer

It would be awesome to be able to see the results of cdk diff in the CodePipeline UI along with a manual approval step before infrastructure changes are deployed by CDK Pipelines.

Use Case

CDK Pipelines are great. I love that there's an officially supported way to deploy CDK from a CI-environment vs. people's local machines. In fact, I created a system for a client that does this with Circle CI before pipelines were available. Eventually, it would be great to move clients over to the officially supported pipelines module from the custom solution.

The one thing that's missing from the current solution, IMO, is the ability to view the cdk diff output in CodePipeline before mutating infrastructure.

Imagine that I'm a developer working on a CDK-managed RDS cluster. Some CloudFormation properties, when updated, require replacement of the Database instance and cannot be performed in-place. Imagine a developer gets their PR approved and merges without running a cdk diff locally, first. Suddenly, they could be in for a big surprise when the RDS cluster is being recreated by CloudFormation.

This situation could be prevented if the developer would have checked out the cdk diff before mutating the infrastructure. The red REQUIRES REPLACEMENT message would have tipped them off that they should look into other ways of accomplishing their update.

This is just one example. It's always a good idea to check out the cdk diff before updating your infrastructure.

Proposed Solution

One way to accomplish this would be to create a CodePipeline stage for running cdk diff. It could use CodeBuild to execute cdk diff, just like it does to run cdk synth. Then, a manual approval step could optionally be added, linking to the CodeBuild output with the cdk diff. If the diff looks OK, the user approves and the applicationStage is deployed. If something looks wrong, the user could reject and fix the problem.

Other

The CodePipeline would look something like this:

Source
|
Build
|
Diff
|-- optional manual approval
|
Update Pipeline
|
Application Stage
  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/pipelinesCDK Pipelines libraryeffort/largeLarge work item – several weeks of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions