-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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): prevent changeset diff for non-deployed stacks #29394
Conversation
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
Changes succeeded in the cli test pipeline. |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
reverts #29394, which prevented changeset creation during `cdk diff` if a stack did not exist. The lookup of the stack to check its existence is failing for customers that have CI/CD that won't assume the deploy role when running CDK diff. Long-term fix: delete the stack if it didn't exist before we created the changeset, but wait for its state to reach `DELETE_COMPLETE` to avoid problems with subsequent commands. Preserves changes from #29172 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Reason for this change
When a stack does not exist in CloudFormation, creating a changeset makes an empty
REVIEW_IN_PROGRESS
stack. We then calldelete-stack
to clean up the empty stack. However, this can cause a race condition with a deploy call.Description of changes
This change prevents changeset diffs for stacks that do not yet exist in CloudFormation. This overrides the changeset diff flag. This change also adds logic for migrate stacks in the old diff logic to represent resource imports without needing the changeset present.
Description of how you validated changes
Testing with new stacks only uses changeset diffs once the stack is deployed. Testing with new migrate stacks only uses changeset diffs once deployed. Pre-deployment the resources correctly show as imports.
Note: the deleted test assumes the diff will be calculated using the mocked changeset. The new logic avoids the changeset, so the test is no longer relevant.
Closes #29265.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license