Review a Terraform plan before merging the PR
使うタイミング: A PR changes 40+ resources and you want a sanity check on blast radius before approving.
前提条件
- Terraform CLI installed and cloud credentials configured —
aws configureor equivalent; tfmcp uses whatever your shell has - tfmcp installed via cargo — cargo install tfmcp
フロー
-
Point tfmcp at the Terraform directorySet TERRAFORM_DIR to ~/work/infra/prod and run terraform plan. Summarize what's changing.✓ コピーしました→ Clean plan summary with add/change/destroy counts
-
Ask for a risk-scored breakdownFor every resource being destroyed or replaced, rate the risk (low/med/high) and explain why. Flag anything stateful.✓ コピーしました→ Risk table highlighting DB, queue, or data resources
-
Get a PR-ready review commentDraft a PR review comment: approve, request changes, or block — with reasoning.✓ コピーしました→ Actionable review text ready to paste
結果: A risk-aware plan review in 3 minutes instead of 30, with no keystrokes spent on apply.
注意点
- Plan succeeds locally but will fail in CI due to different provider versions — Make sure tfmcp's terraform version matches what your CI uses — pin via .terraform-version or tfenv
- State is remote and tfmcp gets stuck on auth — Run
terraform initonce manually to cache backend creds before invoking tfmcp