← Developer resources

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 / checkWhat it blocksProvider 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.
  • anthropic_beta_agent: tools[].custom.name; mcp_servers[].url.{name,url}; tools[].mcp_toolset.{mcp_server_name,default_config.enabled,configs[].{name,enabled}}
  • anthropic_beta_vault_credential: auth.{mcp_oauth,static_bearer}.mcp_server_url; auth.environment_variable.networking.limited.allowed_hosts
  • anthropic_beta_environment: config.cloud.networking.limited.allowed_hosts
CAG002
No secret reads
Secret-looking literals in prompts, descriptions, metadata and URLs; tools named like secret readers; credentials with unrestricted networking.
  • anthropic_beta_agent: system; description; metadata; mcp_servers[].url.{name,url}; tools[].custom.{name,description,input_schema}; tools[].mcp_toolset.configs[].name (when enabled)
  • anthropic_beta_environment: name; description
  • anthropic_beta_vault_credential: metadata; display_name; auth.environment_variable.networking.unrestricted
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.
  • anthropic_workspace: id and resource address
  • anthropic_beta_spend_limit: scope.workspace.workspace_id; amount; period
  • Plan configuration references: configuration.root_module and nested module_calls
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.
  • anthropic_beta_environment: config.cloud.networking.{unrestricted,limited.{allowed_hosts,allow_package_managers,allow_mcp_servers}}
  • anthropic_beta_agent: tools[].agent_toolset_20260401.{default_config.enabled,configs[].{web_fetch,web_search}.{enabled,allowed_domains,blocked_domains}}; mcp_servers[].url.url
  • anthropic_beta_vault_credential: auth.environment_variable.networking.{unrestricted,limited.allowed_hosts}
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.
  • anthropic_beta_agent: tools[].agent_toolset_20260401.{default_config,configs[].{bash,write,edit}} enabled and permission_policy settings
  • anthropic_beta_agent: tools[].mcp_toolset.{default_config,configs[].{name,enabled,permission_policy}}; tools[].custom.name; execution_identity.aws_role.role_arn

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

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