/ipa.destroy
Tear down a deployed infrastructure pattern by executing teardown targets in the generated Makefiles. Removes solution-tier stacks while preserving security and prepare infrastructure.
Invocation
/ipa.destroy
Parameters
/ipa.destroy takes no arguments. It reads configuration from .env and executes teardown targets in scripts/deploy.mk.
Prerequisites:
| Requirement | Source |
|---|---|
.env with IPA variables | /ipa.init |
scripts/deploy.mk | /ipa.compose |
| Security stack deployed | /ipa.security |
| AWS credentials valid | AWS CLI configuration |
| GNU Make installed | System dependency |
What It Does
-
Pre-flight validation — Confirms
.envexists, required variables are present, Makefiles exist, security stack is deployed, AWS credentials are valid, and Make is installed. -
Pre-teardown status check — Extracts stack names from
deploy.mkand checks each stack's current status (Exists, Gone, Transitioning, or Failed). -
Display teardown plan — Shows the status-aware teardown plan with data loss warnings and dry-run commands.
-
Double confirmation — First prompt: "Are you sure?" Second prompt: type the namespace to confirm.
-
Execute teardown — Runs
make -f scripts/deploy.mk teardownto delete stacks in reverse dependency order. -
Post-teardown verification — Confirms all pattern stacks have been deleted.
-
Completion report — Shows deletion status and lists preserved infrastructure.
What Is Preserved
| Infrastructure | Reason |
|---|---|
| Security stack | Managed by /ipa.security, not the deployment pattern |
| Prepare stacks (ECR, Cognito) | One-time prerequisites with persistent data |
To tear down prepare stacks manually:
make -f scripts/prepare.mk teardown-prepare
Failure Handling
| Failure | Resolution |
|---|---|
| Non-empty S3 bucket | Empty the bucket first, then re-run |
| Non-empty ECR repository | Delete all images first, then re-run |
| Cannot delete export | Delete the dependent stack first |
DELETE_FAILED | Identify the blocking resource, fix manually, re-run |
Outputs
No artifacts are created. Pattern stacks are deleted from CloudFormation.
Examples
Tear down a deployed pattern:
/ipa.destroy
Review the status of each stack, confirm twice, and the skill deletes stacks in reverse dependency order.
Related Skills
- /ipa.deploy — Deploys the stacks that
/ipa.destroyremoves - /ipa.compose — Generates the Makefiles with teardown targets
- /ipa.prepare — Prepare stacks are preserved and require manual teardown