terraform-terragrunt-cleanup

Executes approved Terraform and Terragrunt stack cleanup with evidence capture and IAM-retain safety defaults.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/amitkarpe/agent-skills --skill terraform-terragrunt-cleanup-amitkarpe
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: terraform-terragrunt-cleanup
Source: https://github.com/amitkarpe/agent-skills/tree/main/skills/terraform-terragrunt-cleanup
Command: npx skills add https://github.com/amitkarpe/agent-skills --skill terraform-terragrunt-cleanup-amitkarpe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After an infrastructure review identifies deletable AWS resources, teams need a safe, repeatable way to actually destroy them through the owning Terraform or Terragrunt stacks instead of ad-hoc AWS CLI mutations that bypass code ownership and audit trails. ## Core Features & Use Cases - Owning-stack execution only: Runs cleanup exclusively through the repo-owned Terraform or Terragrunt command path, never one-off AWS mutation scripts. - Approval-gated destroys: Requires explicit cleanup approval text before applying, captures destroy plan artifacts, and keeps stack scope narrow. - Safety defaults: Retains shared IAM roles/policies and retain-protected buckets unless explicit delete approval exists, and stops with a blocker when account or environment is unclear. - Use Case: After aws-ec2-ami-cleanup-inventory accepts EC2/EBS/AMI/snapshot cleanup candidates in RESULT.md, use this Skill to execute the approved deletions via the owning Terragrunt stack and record commands, approvals, and residual risk in a new RESULT.md. ## Quick Start Execute the approved cleanup candidates from the review RESULT.md using the owning Terragrunt stack and write the command log and approvals to a new RESULT.md.

Frequently Asked Questions about terraform-terragrunt-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely destroy Terraform-managed AWS resources after a review?▼

Run the destroy through the owning Terraform stack: capture a destroy plan artifact for the approved resource scope, use the repo's lock scope and variable files, and apply only after explicit cleanup approval text exists. Record all commands and outputs in RESULT.md.

How to run Terragrunt cleanup for a specific stack?▼

Use the owning stack's terragrunt path with --terragrunt-non-interactive and keep the target scope narrow to the approved stack. Do not run repo-wide destroy unless that broader scope is explicitly approved.

Should shared IAM roles be deleted during infrastructure cleanup?▼

No. Shared IAM roles and policies that are zero-cost or reused across accounts stay retained by default. They should only be deleted when explicit delete approval is written in the request.

What happens if the AWS account or environment is unclear during cleanup?▼

Execution stops immediately and a blocker is recorded in RESULT.md. No AWS mutation should occur until the account, profile, and environment are unambiguous.

When should I not use stack-based cleanup execution?▼

Do not use it before review approval exists, for retain-protected buckets without explicit owner approval, or for public-facing exposure changes, which require a separate approval gate. It also never replaces owning stack code with one-off AWS CLI scripts.