feat: add --express flag to sam delete#9116
Merged
Merged
Conversation
9 tasks
- Add test_delete_express_mode: deploys a stack, deletes with --express, verifies express mode message and stack deletion - Add express parameter to get_delete_command_list helper - Regenerate schema/samcli.json to include express option for delete command
Member
|
Thanks for the contribution @koteshyelamati ! The change LGTM, I added integ test & schema update. |
roger-zhangg
approved these changes
Jul 8, 2026
tobixlea
approved these changes
Jul 8, 2026
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.
Closes #9115
Which issue(s) does this change fix?
#9115
Why is this change necessary?
#9106 added
--express/--no-expresssupport tosam deployandsam syncfor CloudFormation Express mode, butsam deletedoes not expose the same flag. For teams using express mode during development, delete is part of the same iteration loop: without express support onsam delete, teardown stays on the slower standard path even when the stack was created with--express.How does it address the issue?
Mirrors the deploy/sync implementation for the delete path:
sam deletegains--express/--no-express(default: off, backwards compatible). The flag is persisted tosamconfig.tomlvia the existing--save-paramsmachinery, consistent with deploy/sync.DeleteContextpassesDeploymentConfig={"Mode": "EXPRESS"}to every CloudFormationDeleteStackcall (main stack, ECR companion stack, and theretain_resourcesretry paths).CfnUtils.delete_stackaccepts an optionaldeployment_configand only includesDeploymentConfigin the boto call when provided, so non-express behaviour is byte-for-byte unchanged.expressoption is registered in the delete help formatter (core/options.py).The guided cleanup of S3 artifacts, ECR images, and companion stacks is unchanged — express mode only affects the CloudFormation stack deletion calls, which is what the current
aws cloudformation delete-stack --deployment-configworkaround bypasses.What side effects does this change have?
None when the flag is not used:
DeleteStackis called with exactly the same arguments as before.Checklist
do_clitoDeleteContext, andCfnUtils.delete_stackwith/withoutDeploymentConfig(alltests/unit/commands/deleteandtests/unit/lib/deletepass)