tf-copilot
Purpose
Terraform plan triager with compliance-aware fix suggestions.
Runbook
- Run
scripts/plan.sh [PLAN_FILE]— if noPLAN_FILEis given, it runsterraform plan -out=tf.plan && terraform show -json tf.planin the current directory and writes the JSON output totf-plan.json. - Parse the plan JSON to extract resources to add, change, destroy, plus provider version constraints.
- If the plan contains a destroy count greater than
0, emit a prominent warning and list affected resource addresses. - Run
scripts/lint.shto invokecheckovandtfsecwhen they are available; collect the normalized findings intotf-findings.json. - Produce a markdown report via
scripts/report.shsummarizing the plan diff table, compliance findings (HIGH / MEDIUM / LOW counts), and recommended fixes. - Never apply the plan — this skill is read-only analysis only.
Stop conditions
- Abort if
terraformis missing. - Abort if the working directory has no
.tffiles and noPLAN_FILEis given. - Abort if a plan contains more than 10 destroys without an explicit
--allow-destroyflag toplan.sh. - Abort if
awsCLI credentials are not configured when the plan targets AWS resources.
Output format
tf-plan.json— rawterraform show -jsonoutputtf-findings.json— normalizedcheckov/tfsecfindings- Console: markdown report with a plan diff table and fix suggestions
Example invocations
bash skills/tf-copilot/scripts/plan.shbash skills/tf-copilot/scripts/plan.sh my-saved.plan.jsonbash skills/tf-copilot/scripts/lint.shbash skills/tf-copilot/scripts/report.sh tf-plan.json tf-findings.json- "Analyze my terraform plan and tell me what will be destroyed."