terraform-plan-reviewlisted
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 // ""