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(cli): --no-previous-parameters incorrectly skips updates #11288

Merged
merged 4 commits into from
Nov 4, 2020

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Nov 4, 2020

The CLI skips performing a CloudFormation deployment when it determines
that the deployment will be a no-op (the CLI does this itself instead of
deferring to CloudFormation because CloudFormation cannot accurately
determine whether a changeset is going to be a no-op if Nested Stacks
are involved, and we are looking to improve performance here).

One of the aspects the CLI considers (after checking whether the
templates are the same) is whether any Parameter values have changed.

When --no-previous-parameters was passed, the code incorrectly
completely ignored the existing Parameter values, which effectively
led to it assuming that the "current values" on the stack were the
same as the "default values" of the parameters.

That meant that if a stack that was previously deployed with specific
Parameter values, but then wanted to revert them to the defaults,
this analysis would conclude that since the parameter values were
equal to the defaults, there was "no change".

In hindsight, this is obviously incorrect. The previous values should
have been ignored for the purposes of determining the final
paramater values and the CloudFormation API call parameters, but not
for determining whether there is a change in parameter values between
the current state of the stack and the new state of the stack.


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

The CLI skips performing a CloudFormation deployment when it determines
that the deployment will be a no-op (the CLI does this itself instead of
deferring to CloudFormation because CloudFormation cannot accurately
determine whether a changeset is going to be a no-op if Nested Stacks
are involved, and we are looking to improve performance here).

One of the aspects the CLI considers (after checking whether the
templates are the same) is whether any Parameter values have changed.

When `--no-previous-parameters` was passed, the code incorrectly
completely ignored the existing Parameter values, which effectively
led to it assuming that the "current values" on the stack were the
same as the "default values" of the parameters.

That meant that if a stack that was previously deployed with specific
Parameter values, but then wanted to revert them to the defaults,
this analysis would conclude that since the parameter values were
equal to the defaults, there was "no change".

In hindsight, this is obviously incorrect. The previous values should
have been ignored for the purposes of determining the final
paramater values and the CloudFormation API call parameters, but *not*
for determining whether there is a change in parameter values between
the current state of the stack and the new state of the stack.
@rix0rrr rix0rrr requested a review from a team November 4, 2020 14:50
@rix0rrr rix0rrr self-assigned this Nov 4, 2020
@gitpod-io
Copy link

gitpod-io bot commented Nov 4, 2020

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 4, 2020
Copy link
Contributor

@njlynch njlynch left a comment

Choose a reason for hiding this comment

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

Looks fine to me, sans what looks like one unused class.

/**
* The values that change between the current and a new deployment
*/
export class ParameterChanges {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this being referenced anywhere. Vestigial remains?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GD DMN

yes

Copy link
Contributor

@njlynch njlynch left a comment

Choose a reason for hiding this comment

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

On one hand, I feel like forcing you to include the integ test fixes in a separate PR. On the other... 🤷

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: dfbbb93
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Nov 4, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 1bfc649 into master Nov 4, 2020
@mergify mergify bot deleted the huijbers/no-prev-defaults branch November 4, 2020 16:18
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.

3 participants