Skip to content
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(toolkit): 'cdk deploy' support updates to Outputs #2029

Merged
merged 2 commits into from
Mar 18, 2019

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Mar 16, 2019

If only stack Outputs are changed, CloudFormation generates a ChangeSet
that is executable but has 0 changes.

Before, we looked at the amount of changes to say there was nothing to
do, but now we look at the actual change set status to determine
whether it's an empty change set or not.

The effect is that we can now deploy updates even if only Outputs
changed. This becomes very important when the only thing changed
to a stack is an Output got added because a cross-stack reference
was taken by a downstream stack.

Fixes #778.


Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
  • Title and Description
    • Change type: title prefixed with fix, feat will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

If only stack Outputs are changed, CloudFormation generates a ChangeSet
that is executable but has 0 changes.

Before, we looked at the amount of changes to say there was nothing to
do, but now we look at the actual change set status to determine
whether it's an empty change set or not.

The effect is that we can now deploy updates even if only Outputs
changed. This becomes very important when the only thing changed
to a stack is an Output got added because a cross-stack reference
was taken by a downstream stack.

Fixes #778.
@rix0rrr rix0rrr requested a review from a team as a code owner March 16, 2019 12:47
@rix0rrr rix0rrr changed the title fix(toolkit): 'cdk deploy' updates to Outputs only fix(toolkit): 'cdk deploy' support updates to Outputs Mar 16, 2019
* Its the responsibility of the consumer to replace all calls that
* actually will be called.
*/
export class FakeSDK extends SDK {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MockSDK or SDKMock

// tslint:disable-next-line:max-line-length
throw new Error(`Failed to create ChangeSet ${changeSetName} on ${stackName}: ${description.Status || 'NO_STATUS'}, ${description.StatusReason || 'no reason provided'}`);
});

if (!ret) {
throw new Error('Change set took too long to be created; aborting');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a failure mode here? Like... some kind of a timeout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the question? Can this really happen in practice, can the code path be taken, ...?

* there are changes to Outputs, the change set can still be executed.
*/
export function changeSetHasNoChanges(description: CloudFormation.DescribeChangeSetOutput) {
return description.Status === 'FAILED'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this 4-space indented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be.

@rix0rrr rix0rrr self-assigned this Mar 18, 2019
@rix0rrr rix0rrr merged commit 23509ae into master Mar 18, 2019
@rix0rrr rix0rrr deleted the huijbers/deploy-when-exports-added branch March 18, 2019 11:54
rix0rrr added a commit to alex-berger/aws-cdk that referenced this pull request Mar 19, 2019
If only stack Outputs are changed, CloudFormation generates a ChangeSet
that is executable but has 0 changes.

Before, we looked at the amount of changes to say there was nothing to
do, but now we look at the actual change set status to determine
whether it's an empty change set or not.

The effect is that we can now deploy updates even if only Outputs
changed. This becomes very important when the only thing changed
to a stack is an Output got added because a cross-stack reference
was taken by a downstream stack.

Fixes aws#778.
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cdk diff should indicate if only Output CF description added, then Cloudformation will not update.
4 participants