-
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 destroy does not throw error for a non-existent stack #27293
Closed
Closed
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
56293ef
fix(cli): No exception when stack with wrong cases is deployed
go-to-k bec1d03
Revert "fix(cli): No exception when stack with wrong cases is deployed"
go-to-k 16b0bab
add a test
go-to-k c3963b1
using matchingPattern
go-to-k 85284b2
update for selectStacksForDestroy
go-to-k 6563a5f
fix order of import
go-to-k 27a39fc
search for v1
go-to-k 6b4dbe2
change import order
go-to-k 3dbc266
cli-integ-tests
go-to-k b16eb1f
Merge branch 'main' into fix/destroy-not-exits
go-to-k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you please change the error message to be something more informative as to what does not exist and how they might be able to fix it?
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.
@SankyRed
For example, if you specify stacks
stack-A
,stack-X
, andstack-Y
incdk destroy
, and onlystack-A
exists in your app.In this code, the error message is to be following,
Stacks not exist: stack-X, stack-Y
. So you can know which of stacks do not exist.I think it is to difficult to know this. If you enter non-existent stacks, CDK does not know the way how to fix it unless it gets all the stacks and does a fuzzy search on all of them. Even if we did that, you probably wouldn't get the expected and accurate output.
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.
A tad more context here might be helpful, if we can provide it. Maybe something like
Cannot run cdk destroy on stack(s) ${stacks.join(', ')}. ${notExistPatterns.join(', ')} are not deployed in account: ${account}, region: ${region}.
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.
@TheRealAmazonKendra
I think the format is difficult.
This
notExistPattern
handling andcdk destroy
check the non-existence stacks by looking not the AWS account but stack instance definitions in the cdk app (that is cloud-assembly).My understanding is that
cdk destroy
does not run the command by specifying an account or region, but looks at the stack list (CloudFormationStackArtifact[]
) in cloud-assembly and if each stack has a region/account, it is used; otherwise, the default region/account is used. Actually there is no--region
option incdk destroy
.So we can see that the stack entered does not exist in the CDK app in the first place, but we cannot know WHICH account/region it does not exist in. (We may know that "the stack does not exist in the DEFAULT or ANY region and account", but perhaps that is not the information the user wants to know.)
Then, how about the following message?: