Skip to content

commandDevOps and cloudterraform

Review Terraform Plan

Summarizes a terraform plan in plain words and flags destroys, forced replacements and changes that could cause an outage.

npx workspacetemplates add review-terraform-plan --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/review-terraform-plan.md14 lines · 1.3 KBFile
---
description: Summarizes a terraform plan in plain words and flags destroys, forced replacements and changes that could cause an outage.
argument-hint: "[plan file, or leave empty to run a plan]"
---

Review a Terraform plan: $ARGUMENTS (path to a saved plan file or plan text; if empty, create one).

1. If no file is given, run `terraform plan -out=review.tfplan -input=false` in the current folder, then `terraform show -json review.tfplan`. Never run `terraform apply` or `destroy`.
2. Count resources by action: create, update in place, destroy, replace.
3. List every destroy and replace first. For each replace, name the attribute marked as forcing replacement. State what the resource holds (data, traffic, state) and whether a lifecycle block such as prevent_destroy exists.
4. Flag risky edits: security group or firewall rules opening 0.0.0.0/0, IAM policies with wildcards, encryption turned off, public access on buckets, changes to databases or DNS, and tag-only noise that hides real changes.
5. Note anything computed as "known after apply" that other resources depend on.

Report: a one-paragraph verdict (safe, needs care, or stop), then the destroy and replace table, then the risky edits with the file and line from the configuration. Ask whether to open the findings as review comments.

What it does

Plan output is long, and the line that deletes a database looks the same as the line that adds a tag. This command reads the whole plan and puts the dangerous parts at the top.

It groups changes by action, explains why a resource is being replaced and checks IAM and network edits for widened access. It only reads the plan and never applies it.

Example

you › /review-terraform-plan tfplan.bin

agent › Verdict: needs care. 14 changes: 9 create, 3 update, 1 destroy, 1 replace. Replace: aws_db_instance.main, engine_version forces replacement, no prevent_destroy. Also: security group sg-web now allows 0.0.0.0/0 on 22. Post these as review comments?

Questions

Does it change my infrastructure?
No. It reads a plan and may create a plan file, but apply and destroy are never run.
Does it need cloud credentials?
Only when it has to create the plan itself. Reviewing a saved plan file needs none.
  • Debug Container

    Commanddocker

    Free
  • Deploy Checklist

    CommandDevOps and cloud

    Free
  • Dockerize

    Commanddocker

    Free
  • Document Env Vars

    CommandDevOps and cloud

    Free