-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): cdk diff
always falls back to template only diff
#32165
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1064,6 +1064,46 @@ integTest( | |
}), | ||
); | ||
|
||
integTest( | ||
'cdk diff doesnt show resource metadata changes', | ||
withDefaultFixture(async (fixture) => { | ||
|
||
// GIVEN - small initial stack with default resource metadata | ||
await fixture.cdkDeploy('metadata'); | ||
|
||
// WHEN - changing resource metadata value | ||
const diff = await fixture.cdk(['diff', fixture.fullStackName('metadata')], { | ||
verbose: true, | ||
modEnv: { | ||
INTEG_METADATA_VALUE: 'custom', | ||
}, | ||
}); | ||
|
||
// Assert there are no changes | ||
expect(diff).toContain('There were no differences'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not ideal but better than asserting on a |
||
}), | ||
); | ||
|
||
integTest( | ||
'cdk diff shows resource metadata changes with --no-change-set', | ||
withDefaultFixture(async (fixture) => { | ||
|
||
// GIVEN - small initial stack with default resource metadata | ||
await fixture.cdkDeploy('metadata'); | ||
|
||
// WHEN - changing resource metadata value | ||
const diff = await fixture.cdk(['diff --no-change-set', fixture.fullStackName('metadata')], { | ||
verbose: true, | ||
modEnv: { | ||
INTEG_METADATA_VALUE: 'custom', | ||
}, | ||
}); | ||
|
||
// Assert there are changes | ||
expect(diff).not.toContain('There were no differences'); | ||
}), | ||
); | ||
|
||
integTest('cdk diff with large changeset and custom toolkit stack name and qualifier does not fail', withoutBootstrap(async (fixture) => { | ||
// Bootstrapping with custom toolkit stack name and qualifier | ||
const qualifier = 'abc1111'; | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -400,7 +400,6 @@ async function uploadBodyParameterAndCreateChangeSet( | |||||||||||||||
env.resolvedEnvironment, | ||||||||||||||||
new AssetManifestBuilder(), | ||||||||||||||||
env.resources, | ||||||||||||||||
env.sdk, | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't need the SDK anymore because: aws-cdk/packages/aws-cdk/lib/api/util/template-body-parameter.ts Lines 126 to 132 in 740db43
Not removing it from the invocation resulted in it being passed as the |
||||||||||||||||
); | ||||||||||||||||
const cfn = env.sdk.cloudFormation(); | ||||||||||||||||
const exists = (await CloudFormationStack.lookup(cfn, options.stack.stackName, false)).exists; | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure why, but removing resource metadata changes is the expected behavior when performing diffs with change-sets (see #28336), so this is a solid way to make sure the diff actually creates the change set and uses it.