destroy
Permanently delete the AWS infrastructure created by apply when a project is retired or needs a clean rebuild, protecting you from ongoing AWS charges.
What it does
Section titled “What it does”- Verifies you are in a deploy-stack project (
terraform/backend.tfmust exist) and that theterraformbinary is installed, exiting otherwise. - Asks for explicit confirmation before doing anything destructive; declining cancels with no changes.
- Runs
terraform destroy -auto-approveinterraform/, streaming progress, so all compute resources (ECS, ALB, database, and related resources) are removed. - Parses the state bucket name and region out of
terraform/backend.tf(region defaults tous-east-2when not found), then optionally asks whether to also empty and delete the S3 state bucket viateardownStateBucket. Answering “No” keeps the bucket soapplycan restore the infrastructure later. - Emits an
infrastructure_destroyedtelemetry event recording success and whether the state bucket was retained.
npx deploy-stack destroyThis command accepts no CLI flags. Both confirmation prompts are interactive.