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