> Source: https://agentinfraindex.com/guides/claude-agent-guardrails/ | Content snapshot: 2026-12-04. Check individual evidence and review deadlines before relying on current claims.

[← Developer resources](https://agentinfraindex.com/docs/)  
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](https://github.com/agentinfraindex/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 December 4, 2026. Attribute facts come from the  [provider v0.1.0 resource docs](https://github.com/anthropics/terraform-provider-anthropic/tree/v0.1.0/docs/resources)  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](https://platform.claude.com/docs/en/release-notes/overview) . See the  [provider registry](https://registry.terraform.io/providers/anthropics/anthropic/latest/docs)  and  [Claude Terraform setup docs](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/terraform) .

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](https://github.com/agentinfraindex/claude-agent-guardrails/blob/main/config/guardrails.yaml)  and  [exact attribute coverage](https://github.com/agentinfraindex/claude-agent-guardrails/blob/main/docs/rule-coverage.md)  for your deployment.

[Read the same checks and limitations as JSON](https://agentinfraindex.com/data/claude-agent-guardrails.json)  ·  [Read as Markdown](https://agentinfraindex.com/guides/claude-agent-guardrails/index.md)

## 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. | - `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](https://platform.claude.com/docs/en/managed-agents/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](https://github.com/agentinfraindex/claude-agent-guardrails#offline-demo) : 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](https://github.com/agentinfraindex/claude-agent-guardrails/blob/main/examples/github-action/terraform-policy-check.yml) . 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](https://github.com/agentinfraindex/claude-agent-guardrails/blob/main/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](https://github.com/agentinfraindex/claude-agent-guardrails)  ·  [Developer resources](https://agentinfraindex.com/docs/)  ·  [Query the index through MCP](https://agentinfraindex.com/mcp/)
