Claude Terraform Provider: Power-User Guide to Setup, Auth and Managed Agents

Last updated: December 4, 2026

Anthropic’s Terraform provider, launched in beta on December 3, 2026, lets you manage Claude Platform resources as code. It covers workspaces, service accounts and identity federation, plus Claude Managed Agents, environments, vaults and skills. Install it as anthropics/anthropic, sign in with the ant CLI, and pin versions during the beta.

Contents

What Anthropic launched

On December 3, 2026, Anthropic added a Terraform provider in beta to the Claude Platform. It manages organization resources, such as workspaces, service accounts, workload identity federation issuers and federation rules, and Claude Managed Agents resources, such as agents, environments, vaults and skills (Claude Platform release notes).

The point is review. Changes to agents and workspaces go through the same plan and apply workflow as the rest of your infrastructure, instead of clicks in the Claude Console (Claude Platform docs). If you have been building agents by hand, our Claude Agent SDK guide covers the code-side alternative.

The provider at a glance

Key facts from Anthropic’s docs and the registry page (Claude Platform docs) (Terraform Registry):

Item Details
Status Public beta; resource types and arguments can change
Source address anthropics/anthropic (the only official address)
Terraform version 1.11 or later per the setup guide; 1.11+ required for write-only secrets
Other requirements The ant CLI; Managed Agents access for agent resources
Organization resources Workspaces, members, service accounts, federation, webhooks, telemetry destinations
Managed Agents resources Agents, environments, vaults, skills
Platforms Anthropic (default), aws, google_cloud, bedrock
Destroy behavior Deletion protection on by default; destroying an agent archives it

How to set up the provider

This follows Anthropic’s quickstart, which creates a sandboxed environment and one agent (Claude Platform docs):

  1. Install Terraform 1.11 or later and the ant CLI.
  2. In an empty directory, create main.tf with a required_providers block that sets source = "anthropics/anthropic", and a provider "anthropic" block with organization_id. Every plan then checks that your credentials belong to that organization.
  3. Add an anthropic_beta_environment resource. The example uses a cloud container with limited networking that allows package managers.
  4. Add an anthropic_beta_agent resource with a name, model ID, system prompt and tools. Each change publishes a new server-side version, and version is exported for pinning.
  5. Run ant auth login, and unset ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN, because either overrides the login.
  6. Export TF_VAR_organization_id (shown by ant auth status or in Console organization settings), then run terraform init, plan and apply.
  7. Run terraform plan again. It should report No changes; Anthropic asks you to report anything else as a bug.

One detail in the example is easy to miss: with limited networking and no allowed_hosts, web search and web fetch would return nothing, so the quickstart turns both tools off.

Authentication and credential order

With the default platform, a provider block uses the first credential it finds, in this order (Terraform Registry):

  1. api_key, auth_token or profile in the block
  2. ANTHROPIC_API_KEY
  3. ANTHROPIC_AUTH_TOKEN
  4. The ant profile named by ANTHROPIC_PROFILE
  5. Workload identity federation environment variables
  6. The ant CLI’s active profile

Different resources need different credentials (Terraform Registry):

Resources Credential needed
Workspaces, members, external keys, telemetry destinations, organization webhooks Admin API key or a profile with org:admin
Service accounts and federation Profile with org:admin
RBAC, plugin marketplaces, Claude Tag Enterprise Admin API key with that feature’s scopes
Claude Managed Agents API key or profile for the workspace
MCP tunnels and certificates Federation profile with workspace:manage_tunnels or org:admin

To manage two identities from one configuration, add a second provider block with an alias and its own profile, then set provider = anthropic.research (or your alias) on the resources that should use it. In CI, Anthropic recommends a federation profile rather than raw environment variables.

AWS, Google Cloud and Amazon Bedrock

Set platform to manage resources outside the Anthropic API (Terraform Registry):

  • AWS and Google Cloud: platform = "aws" or "google_cloud" manages resources on Claude Platform on AWS or Claude Models on Google Cloud (Anthropic managed). Both need the workspace_id of an existing workspace and use your cloud credentials.
  • Amazon Bedrock: platform = "bedrock" exposes only anthropic_beta_bedrock_agent, anthropic_beta_bedrock_memory_store and anthropic_beta_bedrock_memory. It uses the AWS credential chain and stops if AWS_BEARER_TOKEN_BEDROCK is set, because Managed Agents does not accept a Bedrock API key. Here workspace_id is the Bedrock project ID and defaults to default.
  • No moves: a resource cannot move to another platform, account, project, region or workspace. Recreate it, or terraform state rm and import the copy that already exists there.

For the Bedrock side in depth, see our Claude Managed Agents on Amazon Bedrock guide.

Security: state, secrets and least privilege

The registry page lists several risks that matter more here than with most providers (Terraform Registry):

  • State is plain text: state and plan output include system prompts, tool schemas, memory content and inline skill files. Use an encrypted, access-controlled backend.
  • Secrets: arguments ending in _wo, such as vault credential secrets, are write-only and never stored in state. Pass secrets through variables declared with ephemeral = true, or a saved plan can still contain them.
  • MCP URLs: state stores the MCP server URL of every agent Terraform reads, so keep tokens in a vault credential, not the URL.
  • Least privilege: prefer workload identity federation or a key scoped to one workspace. With an organization-level credential, pin module versions and commit .terraform.lock.hcl.
  • Source address: a provider from any address other than anthropics/anthropic could read your credentials.

Workflows and caveats

Patterns that follow from the docs:

  • Agents in pull requests: keep system prompts and tool settings in Git, so a prompt change gets the same review as code. Pin an agent’s exported version where a session must not change under you.
  • Beta upgrades: commit the lock file so you choose when to adopt schema changes.
  • Teardown: set deletion_protection = false, apply, then destroy. Destroy deletes environments but archives agents.

Anthropic publishes no separate price for the provider; the resources it creates are billed as usual. For other recent Claude tooling, see our guides to Claude Code 2.1.335 and Claude Ship.

Frequently asked questions

Is there an official Terraform provider for Claude?

Yes. Anthropic launched an official Terraform provider in beta on December 3, 2026. Its only official source address in the Terraform Registry is anthropics/anthropic.

What can the Anthropic Terraform provider manage?

Organization resources such as workspaces, service accounts and workload identity federation, plus Claude Managed Agents resources such as agents, environments, vaults and skills.

Which Terraform version do I need?

The Claude Platform guide lists Terraform 1.11 or later. The registry page says 1.0 or later works, but 1.11 or later is needed to set write-only secrets.

Does the provider work with Amazon Bedrock?

Yes, with platform set to bedrock, but only for Bedrock agents, memory stores and memories. It uses the AWS credential chain and rejects Amazon Bedrock API keys.

Why does terraform destroy fail?

Deletion protection is on by default. Set deletion_protection to false on the resources, apply, then run terraform destroy. Destroying an agent archives it.

Sources

Image: Claude AI symbol by Anthropic, CC0, via Wikimedia Commons. Claude is a trademark of Anthropic and Terraform is a trademark of HashiCorp. FreeAnswers is not affiliated with either company.

Related answers

1 thought on “Claude Terraform Provider: Power-User Guide to Setup, Auth and Managed Agents”

Leave a Comment