TERRAFORM PLAN CHECKS · PROVIDER BETA
Guardrails for Claude Managed Agents Terraform plans
Agents get tools, spend capacity and network reach from Terraform configuration. claude-agent-guardrails is a free, open-source Apache-2.0 kit that checks terraform plan JSON before terraform apply, using OPA/Rego and Conftest.
Published by Agent Infra Index. Not affiliated with or endorsed by Anthropic.
Checked . Attribute facts come from the provider v0.1.0 resource docs and the Claude documentation linked below.
Check the plan before apply
Anthropic announced its official anthropics/anthropic Terraform provider in public beta in the December 3, 2026 Claude Platform release notes. See the provider registry and Claude Terraform setup docs.
The kit evaluates creates and updates, including replacements. Deletes, no-op resources and resources outside the plan are not checked. Unknown checked values block the plan unless the configuration proves an omitted field uses a documented default.
Plan checks only, not runtime enforcement. Names and hosts are heuristics; filesystem secrets, per-agent spending and session environment selection are not covered. Provider v0.1.0 is beta; attributes may change.
This is a kit Agent Infra Index published, not a ranking or recommendation. Review the policy configuration and exact attribute coverage for your deployment.
Read the same checks and limitations as JSON · Read as Markdown
The five checks
Each rule blocks the configuration described below; a pass does not establish what an agent will do at runtime.
| ID / check | What it blocks | Provider attributes it reads |
|---|---|---|
| CAG001 No code commit | Recognized commit-tool names, code-host MCP access unless the toolset is disabled by default with only read tools enabled, and code-host credential destinations or environment hosts. |
|
| CAG002 No secret reads | Secret-looking literals in prompts, descriptions, metadata and URLs; tools named like secret readers; credentials with unrestricted networking. |
|
| CAG003 Spend cap per workspace | A changed workspace without a matching workspace-scoped spend limit in the same plan, an amount above the configured ceiling, or a disallowed period. The amount must be a non-negative integer string in minor currency units. |
|
| CAG004 Allowed sites | Unrestricted cloud or credential networking; hosts outside the configured allowlist; enabled web tools without approved allowed_domains. Package-manager and MCP network allowances are checked against configuration too. |
|
| CAG005 Risky tool | Enabled built-in bash, write or edit tools without an accepted gate; risky MCP policies or custom-tool names; AWS execution roles outside the configured allowlist. Built-ins default to always_allow; the kit requires always_ask by default. |
|
Built-in tools default to always_allow; MCP toolsets default to always_ask. The kit’s default human gate is always_ask; auto does not count as that gate. Custom tools run in your application and have no provider permission policy. See Claude permission policies.
What it cannot check
- There is no per-agent “can commit” attribute. Built-in bash can run git, and package-manager access may reach code hosts.
- Built-in read, grep, glob and bash tools have no path restrictions. Secrets on the container filesystem are not covered.
- Spend limits attach to workspace, organization or user scopes, not agents. Workspace-scoped limits are early access in the API; a valid plan does not establish access. An organization limit does not satisfy CAG003.
- Agents are not linked to a workspace or environment by Terraform attributes. Credentials determine the agent workspace; the environment is chosen when a session starts. The checks cannot prove those resources belong together.
- Tool names and hosts are heuristics, not proof of tool behavior. Runtime prompts, outputs, redirects and DNS changes are outside these checks.
- Plan JSON can hold sensitive values in plaintext. Do not upload it publicly. Restrict access to saved binary plans too.
- The provider is beta and attributes may change. These facts refer to v0.1.0; review the schema before adopting another version.
Try it offline
No Anthropic account is needed. Install Git and jq, then clone the kit and install its pinned tools with the commands below. Cloning and tool installation need internet access; scripts/demo.sh uses committed fixtures offline and never applies infrastructure. Terraform 1.11+ is needed only to produce new plans.
git clone https://github.com/agentinfraindex/claude-agent-guardrails.git
cd claude-agent-guardrails
scripts/install-tools.sh .tools
export PATH="$PWD/.tools:$PATH"
scripts/demo.sh Output copied from the repository README: the safe fixture passes and the risky fixture is blocked with CAG001–CAG005.
SAFE: passed (exit 0)
RISKY: blocked (exit 1)
CAG001 anthropic_beta_agent.demo: mcp_servers exposes a code host; remove it or disable its toolset by default and enable only read tools.
CAG002 anthropic_beta_agent.demo: system contains a secret-looking literal; remove it and use a scoped vault credential.
CAG003 anthropic_workspace.demo: workspace spend cap could not be verified; add a spend limit in this plan with scope.workspace.workspace_id referencing this workspace (or its known id).
CAG004 anthropic_beta_agent.demo: mcp_servers.url.url is outside allowed_sites or could not be verified; use an approved HTTP(S) hostname.
CAG004 anthropic_beta_environment.demo: config.cloud.networking is unrestricted; use limited.allowed_hosts from guardrails.allowed_sites.
CAG005 anthropic_beta_agent.demo: tools.bash is enabled without a human gate; set permission_policy to a gated_policies value or disable it.
DEMO: passed; all five rule IDs found. Use it in CI
Start with the Terraform policy check workflow. Vendor the policy and configuration or pin the kit checkout to a reviewed commit. Set allowed hosts, tool gates and spend ceilings in config/guardrails.yaml.
Save a plan with terraform plan -out=tfplan, export it with terraform show -json tfplan > plan.json, and run conftest test --policy policy --data config plan.json. After a passing check and your normal review, apply that same saved plan. Keep plan files private and remove temporary files after use.
Kit repository · Developer resources · Query the index through MCP