aws-cdk: Running "cdk diff" returns error code 1

Despite the fix introduced in #4650. I’m still experiencing cdk diff exiting with status code 1.

Reproduction Steps

Run the following shell script:

#!/usr/bin/env bash

set -uo pipefail

cdk diff
EXIT_STATUS=$?
echo "Exit: $EXIT_STATUS"

Environment

  • CLI Version : 1.21.1 (build 842cc5f)
  • Framework Version: 1.21.1 (build 842cc5f)
  • OS : macOS Catalina 10.15.2
  • Language : Typescript

Other

Relates to #2111


This is 🐛 Bug Report

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

thanks for the update! added this to the cdk.json files and it works as expected through codebuild.

@xycodex @udondan - yep that’s a bug (fix is being tracked in #7399)

Same issue as @udondan cdk version: 1.32.2 (build e19e206)

Resolved this issue by adding "aws-cdk:enableDiffNoFail": "true" in cdk.context.json. But, according to the changelog , cdk diff should always exit with 0 ?

@nicklaw5 - can you provide some additional information?

what version of the CDK was your project created with? I’m trying to reproduce your error but can’t seem to get there.

Steps I’ve tried:

  1. cdk init --language typescript
  2. cdk diff - this has a diff (Conditions) -> echo $? returns 0
  3. cdk deploy
  4. cdk diff - No differences -> echo $? returns 0
  5. cdk diff --fail -> echo $? returns 1

what does your cdk.context.json contain in it? does it have the "aws-cdk:enableDiffNoFail": "true" key?