Terraspin / 2026 Filed under Infrastructure · Automation Open Source · MIT Docs EN
Download Star

CLI Reference

Reads a terraform plan JSON from a file or stdin and produces risk analysis.

Synopsis

terraspin [flags] <plan.json> terraspin serve [flags] terraspin diff <state-a> <state-b> [flags] terraspin version

Analyze command (default)

Reads a terraform plan JSON from a file or stdin and produces risk analysis.

terraspin [flags] <plan.json> terraform plan -json | terraspin [flags]

Flags

FlagDefaultDescription
--formattextOutput format: text, json, markdown
--fail-on(none)Exit 1 if risk >= tier: critical, high, medium, low
--no-aifalseRule-based only, skip LLM call
--llmclaudeLLM provider: claude, openai, ollama
--model(none)Model name (provider default if empty)
--ollama-hosthttp://localhost:11434Ollama host URL
-vfalseShow all risk tiers including medium and low
--config.terraspin.ymlPath to config file
--post-commentfalsePost analysis as GitHub PR / GitLab MR comment

Exit codes

CodeMeaning
0Success
1--fail-on threshold exceeded
2Input or parsing error
3MCP server error

Serve command (MCP server)

Runs Terraspin as a Model Context Protocol server for AI coding assistants (Claude Code, Copilot, Cursor).

terraspin serve [flags]

Flags

FlagDefaultDescription
--transportstdioMCP transport: stdio or sse
--port8080SSE port
--hostlocalhostSSE host

Tools exposed

ToolDescription
analyze_planFull plan analysis with risk scoring
get_blast_radiusDependency graph for a resource
explain_changePlain-English explanation of a change
get_risk_summaryCompact risk tier summary
suggest_rollbackRollback steps for the current plan

Claude Code config

{ "mcpServers": { "terraspin": { "command": "terraspin", "args": ["serve"] } } }

Diff command

Compares two terraform plan JSON files (different environments, states, or runs).

terraspin diff <plan_a.json> <plan_b.json> [flags]

Flags

FlagDefaultDescription
--formattextOutput format: text, json, markdown
--no-aifalseRule-based only, skip LLM call
--llmclaudeLLM provider for drift narrative
--model(none)Model name
--ollama-hosthttp://localhost:11434Ollama host URL
--label-aplan-aLabel for the first plan
--label-bplan-bLabel for the second plan

Example

terraspin diff prod-plan.json staging-plan.json --label-a prod --label-b staging

GitHub Action

Use the standalone GitHub Action repository:

- name: Terraspin plan analysis uses: terraspin/terraspin-action@v1 with: plan-file: plan.json fail-on: high post-comment: true env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Documentation
On this page