← ClaudeAtlas

terraform-plan-reviewlisted

Review a Terraform/OpenTofu plan before apply — flag destroys and forced replacements, data-loss risk, IAM/permission widening, public exposure, drift and state surprises, and produce a go/no-go summary. Use when the user shares a plan, asks "is this safe to apply", or is about to run terraform/tofu apply.
polytheseus/sre-skills · ★ 0 · DevOps & Infrastructure · score 72
Install: claude install-skill polytheseus/sre-skills
# Terraform plan review Your output is a **risk-ranked review** of exactly what the plan will do, with a clear recommendation: *safe to apply*, *apply with care*, or *do not apply*. ## Ground rules - Never run `terraform apply`, `destroy`, `import`, `state rm/mv`, or `force-unlock` yourself unless the user explicitly asks, and even then confirm the workspace and target first. - `plan`, `show`, `validate`, `fmt -check`, `state list/show`, and `providers` are fine to run. - Treat plan output as possibly containing secrets. Don't echo sensitive values back to the user. ## 1. Get a machine-readable plan ```bash terraform workspace show terraform plan -out=tfplan -input=false -lock=false terraform show -json tfplan > tfplan.json ``` (Use `tofu` instead of `terraform` if that's what the repo uses. If the user pasted a text plan, work from that.) Summarise the actions: ```bash jq -r '.resource_changes[] | select(.change.actions != ["no-op"]) | "\(.change.actions | join("/"))\t\(.address)"' tfplan.json | sort | uniq -c | sort -rn ``` Pull the dangerous ones out first: ```bash # Deletes and replacements (["delete","create"] or ["create","delete"]) jq -r '.resource_changes[] | select(.change.actions | index("delete")) | "\(.change.actions | join("/"))\t\(.address)"' tfplan.json # Which attribute forces each replacement jq -r '.resource_changes[] | select(.action_reason != null or (.change.replace_paths // [] | length > 0)) | "\(.address)\t\(.action_reason // ""