{"schema_version":1,"id":"claude-agent-guardrails","title":"Guardrails for Claude Managed Agents Terraform plans","url":"/guides/claude-agent-guardrails/","updated":"2026-12-04","source_url":"https://agentinfraindex.com/data/claude-agent-guardrails.json","description":"Five OPA/Rego and Conftest checks for Anthropic Terraform plans: code-commit access, secret reads, workspace spend limits, allowed sites and risky tools, with an offline demo and explicit limits.","disclosure":"Published by Agent Infra Index. Not affiliated with or endorsed by Anthropic.","limits":"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.","keywords":["claude agent guardrails","claude-agent-guardrails","claude managed agents terraform","anthropic terraform guardrails","check claude terraform plans"],"links":{"repo":"https://github.com/agentinfraindex/claude-agent-guardrails","coverage":"https://github.com/agentinfraindex/claude-agent-guardrails/blob/main/docs/rule-coverage.md","config":"https://github.com/agentinfraindex/claude-agent-guardrails/blob/main/config/guardrails.yaml","ci":"https://github.com/agentinfraindex/claude-agent-guardrails/blob/main/examples/github-action/terraform-policy-check.yml","registry":"https://registry.terraform.io/providers/anthropics/anthropic/latest/docs","provider":"https://github.com/anthropics/terraform-provider-anthropic/tree/v0.1.0/docs/resources","terraform":"https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/terraform","release":"https://platform.claude.com/docs/en/release-notes/overview","permissions":"https://platform.claude.com/docs/en/managed-agents/permission-policies"},"checks":[{"id":"CAG001","name":"No code commit","blocks":"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.","attributes":["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"]},{"id":"CAG002","name":"No secret reads","blocks":"Secret-looking literals in prompts, descriptions, metadata and URLs; tools named like secret readers; credentials with unrestricted networking.","attributes":["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"]},{"id":"CAG003","name":"Spend cap per workspace","blocks":"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.","attributes":["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"]},{"id":"CAG004","name":"Allowed sites","blocks":"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.","attributes":["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}"]},{"id":"CAG005","name":"Risky tool","blocks":"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.","attributes":["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"]}],"boundaries":["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."],"demo":{"command":"git clone https://github.com/agentinfraindex/claude-agent-guardrails.git\ncd claude-agent-guardrails\nscripts/install-tools.sh .tools\nexport PATH=\"$PWD/.tools:$PATH\"\nscripts/demo.sh","output":"SAFE: passed (exit 0)\nRISKY: blocked (exit 1)\nCAG001 anthropic_beta_agent.demo: mcp_servers exposes a code host; remove it or disable its toolset by default and enable only read tools.\nCAG002 anthropic_beta_agent.demo: system contains a secret-looking literal; remove it and use a scoped vault credential.\nCAG003 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).\nCAG004 anthropic_beta_agent.demo: mcp_servers.url.url is outside allowed_sites or could not be verified; use an approved HTTP(S) hostname.\nCAG004 anthropic_beta_environment.demo: config.cloud.networking is unrestricted; use limited.allowed_hosts from guardrails.allowed_sites.\nCAG005 anthropic_beta_agent.demo: tools.bash is enabled without a human gate; set permission_policy to a gated_policies value or disable it.\nDEMO: passed; all five rule IDs found."}}