- Home
- Skills
- DevOps & Cloud
- Terraform Plan Blast-Radius & Safe State Surgery
Works with the AI Agents you already use
Terraform Plan Blast-Radius & Safe State Surgery
Catch accidental RDS, VPC, S3, and KMS force-replacements in Terraform plan JSON before apply—and auto-generate zero-downtime moved {} blocks and PR blast-radius cards.
$9
Terraform Plan Blast-Radius & Safe State Surgery
Example session with this skill installed
Analyze plan.json and main.tf before we merge this Terraform VPC & RDS refactor PR. Flag any destructive stateful replacements, generate safe moved {} blocks, and do not edit any files until I approve.
- Read your context and instructions
- Compiled the terraform plan blast-radius
Terraform Plan Blast-Radius Review Card
Verdict: CRITICAL BLAST RADIUS · Risk Tier: CRITICAL
Planned Actions: 2 create · 1 update · 2 replace · 2 destroy
| Rule | Severity | Resource | Blast-Radius Impact | Safe Fix |
|---|---|---|---|---|
TFP-001 | Critical | aws_db_instance.orders | Force-replacement (engine_version / identifier change) wipes live DB | Use blue/green deployment or restore from snapshot; add prevent_destroy = true |
TFP-002 | Critical | aws_kms_key.app_data | Destroying KMS key permanently invalidates encrypted EBS/RDS/S3 data | Keep existing key; remove destroy or migrate with moved {} |
TFP-003 | High | aws_subnet.priv[0] → aws_subnet.private["a"] | Destroy + create rename pair from count → for_each refactor | Add declarative moved {} block (0 downtime, 0 recreation) |
TFP-005 | High | aws_security_group.db | Planned after state opens 0.0.0.0/0 on port 5432 | Restrict CIDR to private app subnet only |
Auto-Generated moves.tf (Zero-Downtime State Surgery)
moved {
from = aws_subnet.priv[0]
to = aws_subnet.private["a"]
}
Next Steps (Approval Required)
- Block
terraform applyuntilTFP-001(RDS) andTFP-002(KMS) are resolved. - Reply
"Write moves.tf and lifecycle guards" to apply the safe refactor blocks and re-run terraform plan to confirm 0 to destroy.
Connects securely to your tools. The creator never sees your data.
About this skill
Stop Accidental RDS, VPC, and KMS Force-Replacements Before terraform apply
Terraform Plan Blast-Radius & Safe State Surgery pairs a zero-dependency, strictly read-only Python plan analyzer (scripts/analyze_tf_plan.py) with senior Terraform state-refactoring playbooks. Point it at terraform show -json tfplan (and your .tf files) to surface stateful destroys, count index-shift traps, security regressions, and exact declarative moved {} / import {} / lifecycle fixes—before a single cloud resource is touched.
What It Detects (7 High-Impact Rules)
TFP-001(Critical): Destroy or force-replacement of stateful data stores (aws_db_instance,aws_rds_cluster,aws_dynamodb_table,aws_s3_bucket,aws_ebs_volume,google_sql_database_instance,azurerm_postgresql_flexible_server).TFP-002(Critical): Destroy/replacement of cryptographic, IAM, or core network backbone (aws_kms_key,aws_vpc,aws_subnet,aws_nat_gateway,aws_eks_cluster,aws_iam_role).TFP-003(High): Destroy + create rename/refactor pairs that can be converted into zero-downtime declarativemoved {}blocks.TFP-004(High): Large blast-radius plans (>10 destroys/replaces) and unexpectedreplace_pathsforce-new triggers.TFP-005(High): Security regressions in plannedafterstate (0.0.0.0/0on SSH/RDP/DB ports,publicly_accessible: true,storage_encrypted: false).TFP-006&TFP-007(Medium): Missingprevent_destroy/create_before_destroylifecycles andcountindex-shift traps on stateful resources.
How to Use
Generate a plan JSON locally (terraform plan -out=tfplan && terraform show -json tfplan > plan.json) and ask your AI agent:
- "Analyze
plan.jsonfor blast radius and stateful replacements before we apply." - "Generate declarative
moved {}blocks so this module refactor doesn't destroy our RDS or subnets."
Or run the bundled read-only script directly:
python3 scripts/analyze_tf_plan.py --path plan.json --format markdown
What's Inside (15 Files)
SKILL.md— 5-step deterministic blast-radius workflow withSAFE/REVIEW REQUIRED/CRITICAL BLAST RADIUSgatingscripts/analyze_tf_plan.py— Pure Python 3 stdlib analyzer (--fail-on-criticalCI gate, JSON/Markdown output, automoved {}generation)references/— Stateful resource risk matrix, declarativemoved/import/removedsurgery playbook, and rule catalogtemplates/&examples/— PR blast-radius review card, phased state-surgery plan, and worked RDS/VPC audittests/— Risky & safe plan JSON fixtures + runnable unit tests
Security & Privacy Guarantee
- 100% offline & read-only — never runs
terraform apply/destroy/state rm, zero cloud creds, skips.env*,*.tfstate*, and*.tfvars*.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.
Static analysis of Terraform plan JSON and .tf HCL files; does not execute terraform plan/apply or inspect live cloud provider state.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago
- Software
Python 3.9+ (stdlib only)
Permissions
Bundled analyzer is 100% offline and read-only; skips .env, .tfstate, and .tfvars files. Write Files is only used after explicit user approval to write moves.tf or lifecycle fixes.