Repository navigation
Conversation
… destroyed Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>
MaxonT
requested a deployment
to
integ-approval
November 27, 2026 20:45 — with
GitHub Actions
Waiting
aws-cdk-automation
enabled auto-merge
November 27, 2026 20:45
rix0rrr
approved these changes
Nov 30, 2026
This branch is waiting to be deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hey, this touches the cdk destroy command so it no longer says it succeeded when there are no stacks to destroy; I only had the issue title, so please check the message wording.
Fixes aws/aws-cdk#22240
Thanks to peterwoodworth and rix0rrr for laying out the options on that issue. The "no such stack" warning for a name that matches nothing in the app already exists (#984); what is still missing is the case where the stack is in the app but was never deployed (or is already gone). There
deployments.destroyStack()finds nothing in CloudFormation and returns without an ARN, anddestroystill prints✅ Stack: destroyed.This changes only that message: when
destroyStackreturns nostackArn, the result line reads✅ Stack: not deployed, nothing to destroy. It is still a success (rix0rrr's point that the end state is what the user asked for), so there is no error and no change to the exit code or toDestroyResult(stackExistedwas alreadyfalsethere). I did not move the existence lookup before the confirmation prompt, which the issue also floats; that is a bigger behaviour change and I wanted to keep this one small.The message is produced in
Toolkit._destroy, so a destroy run as rollback cleanup fromdeploygets the same wording for a missing stack.How I checked: added a test in
toolkit-lib/test/actions/destroy.test.tsfor a mockeddestroyStackwith no ARN; it fails on the base commit and passes with the change. The default mock in that file now returns an ARN, so the existing "destroyed" assertions still describe a real deletion.npx jest test/actions/destroy.test.tspasses (26 tests). Not run: the full toolkit-lib oraws-cdksuites, eslint (the local eslint config did not load), and a realcdk destroyagainst AWS.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license