You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(aws-cdk): cdk diff always fails on diff (#17862)
In v1, the original behavior was that `cdk diff` exited 0 on a clean diff (no
changes), and exited 1 on changes. #4721 introduced a new feature flag to always
have `cdk diff` exit 0. As is standard, the "default" for the flag was `false`,
but the future behavior was `true`, meaning any new CDK project created after
that release (v1.19.0) defaulted to always exiting 0.
In v2, the feature flag was expired, meaning users could no longer set
it. Typically, the behavior (`FeatureFlags.isEnabled`) checks and errors if an
expired flag is explicitly set, and always returns true for expired flags
otherwise. However, the CDK CLI helper function did not contain this
functionality. That means for current v2 projects, the v1-ported default value
is used (false). This means `cdk diff` *always* exits 1 when there's a diff, and
there's no way for a user to disable this behavior.
This change updates the CLI behavior to default to true for expired flags, same
as any other feature flag check; this means `cdk diff` will return to exiting 0,
as v1 apps have been doing for years. The `FeatureFlags.isEnabled` method can't
be used, as it requires a Construct node.
I also took the liberty of explicitly setting the "default" to true for all
expired flags, so any other direct access of the flag (not using the FeatureFlag
library) will have the same consistent behavior.
0 commit comments