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

CLI: don’t attempt to update stack if template didn’t change #6216

Closed
1 of 2 tasks
eladb opened this issue Feb 11, 2020 · 3 comments · Fixed by #6346
Closed
1 of 2 tasks

CLI: don’t attempt to update stack if template didn’t change #6216

eladb opened this issue Feb 11, 2020 · 3 comments · Fixed by #6346
Assignees
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. package/tools Related to AWS CDK Tools or CLI

Comments

@eladb
Copy link
Contributor

eladb commented Feb 11, 2020

We should add “short circuit” feature to the CLI which will skip change set creation and execution if the currently deployed template is identical to the one we are we’re requested to deploy.

Use Case

This will improve the user experience and will address two issues :

  1. [aws-eks] Nested stacks always cause an update #6046: where nested stacks cause an update even if they haven’t changed. CloudFormation currently attempts to update nested stacks even if their template haven’t changed. This is because theoretically CFN can’t tell if the template had changed or not, but CDK nested stack templates are immutable and therefore if the URL didn’t change, we know for sure that an update is not needed.

  2. "FAILED, No updates are to be performed" when adding a "Transform" to a stack #2553: creating a change set with no updates fails.

Proposed Solution

We should make this the default behavior but allow people to disable through something like --force

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@eladb eladb added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 11, 2020
@SomayaB SomayaB added package/tools Related to AWS CDK Tools or CLI and removed needs-triage This issue or PR still needs to be triaged. labels Feb 13, 2020
@eladb
Copy link
Contributor Author

eladb commented Feb 18, 2020

@shivlaks I am picking this up

@eladb eladb added the in-progress This issue is being actively worked on. label Feb 18, 2020
@eladb eladb assigned eladb and unassigned shivlaks Feb 18, 2020
eladb pushed a commit that referenced this issue Feb 18, 2020
Bail-out before executing and creating change sets when the currently deployed template is identical to the one we are about to deploy.

This resolves #6046, where a stack that contains nested stack(s) will always try to update since CloudFormation assumes the nested template might have changed. In the CDK, since nested template URLs are immutable, we can trust that the URL will be changed, and therefore invalidate the *parent* template.

This also fixes the bug described in #2553, where a stack that includes a `Transform` always fail to deploy with `No updates are to be performed` when there are no changes to it.

The switch `--force` can be used to override this behavior.

Added unit test and performed a few manual tests to verify both bugs are resolved.

Resolves #6216
@eladb eladb added the effort/small Small work item – less than a day of effort label Feb 19, 2020
@mergify mergify bot closed this as completed in #6346 Feb 19, 2020
mergify bot added a commit that referenced this issue Feb 19, 2020
* feat(cli): skip deployment if template did not change

Bail-out before executing and creating change sets when the currently deployed template is identical to the one we are about to deploy.

This resolves #6046, where a stack that contains nested stack(s) will always try to update since CloudFormation assumes the nested template might have changed. In the CDK, since nested template URLs are immutable, we can trust that the URL will be changed, and therefore invalidate the *parent* template.

This also fixes the bug described in #2553, where a stack that includes a `Transform` always fail to deploy with `No updates are to be performed` when there are no changes to it.

The switch `--force` can be used to override this behavior.

Added unit test and performed a few manual tests to verify both bugs are resolved.

Resolves #6216

* Add alias -f for —force

* Add integration test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@jmrtinb
Copy link

jmrtinb commented Apr 9, 2020

Is there any reason the output regarding how to override (using the --force flag) is printed only at debug? I just spent quite a while trying to figure out some stacks weren't deploying (they used SSM parameters, so the template doesn't change, but if the parameter values change the stack needs to be updated), and this was the cause. It would have been much easier to debug what was going on if there was an output along with "no changes" stating why cdk thought there were no changes.

@donkersgoed-postnl
Copy link

This problems seems to be reintroduced with the DefaultStackSynthesizer. Created a new issue for it: #16959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants