Friends join forces: Anthropic ships a Terraform provider
I took Anthropic's new Terraform provider for a spin and built, changed, ran and tore down a Claude agent with plan and apply.

I thought I would cover this update since two of my favorite worlds are coming together. Anthropic just dropped a Terraform provider to public beta.
The Anthropic Terraform provider manages Claude Platform resources as code. Changes to them go through the same review, plan, and apply workflow as your other infrastructure.
That's amazing: you can now use Terraform to bake AI agent deployments into your enterprise IT architecture, right next to the networks, clusters and IAM you already manage with it. Rather than just read the docs, I spent a Sunday morning trying it.
What's in the box
The provider is anthropics/anthropic on the Terraform Registry. Version 0.1.0 landed on December 3. It covers two broad areas:
- Your Anthropic organization: workspaces and members, service accounts, workload identity federation (so CI can authenticate with no stored key), spend limits, webhooks, telemetry destinations and, on Enterprise, RBAC groups and roles.
- Claude Managed Agents: agents, the cloud environments their tools run in, deployments, memory stores, skills, vaults for credentials, and MCP tunnels. Most of these are still
beta_resources.
It also speaks to Claude Platform on AWS, Claude on Google Cloud, and Amazon Bedrock through a platform setting.
The test: build, change, run, destroy
I installed Terraform and Anthropic's ant CLI, signed in with ant auth login (a browser sign-in, no API key to copy around) and started from Anthropic's quickstart: a sandbox environment with limited networking, and an agent on Claude Opus 5.5.
provider "anthropic" {
organization_id = var.organization_id
}
resource "anthropic_beta_environment" "sandbox" {
name = "tf-lab"
config = {
cloud = {
networking = {
limited = { allow_package_managers = true }
}
}
}
}
resource "anthropic_beta_agent" "assistant" {
name = "tf-lab-assistant"
model = { id = "claude-opus-5-5" }
system = "You are a concise, careful assistant."
}
(I've trimmed the tool configuration; the full quickstart is in the provider's repo.)
Plan and apply. terraform plan proposed two resources, and printed a warning naming the exact organization ID it was about to change. The organization_id in the provider block is a guard: if your credentials belong to a different org, the run stops. Apply took about a second. A second plan came back with No changes, so there was no drift right out of the gate.
Change the agent. I added "Answer in three sentences or fewer" to the system prompt. The plan showed the old and new prompt side by side as an in-place update, and after apply the agent's version went from 1 to 2. Every change publishes a new server-side version, which you can pin sessions to. A prompt change now gets the same pull request review as a firewall rule.
~ resource "anthropic_beta_agent" "assistant" {
~ system = "You are a concise, careful assistant." -> "You are a concise, careful assistant. Answer in three sentences or fewer."
~ version = 1 -> (known after apply)
}
Run it. Terraform defines agents; it doesn't talk to them. To prove the agent worked, I started one session from the ant CLI with a $1 spending cap and asked what Terraform state stores and why it should be protected. Version 2 answered in exactly three sentences. List cost: 4 cents.
Tear it down. terraform destroy refused. Deletion protection is on by default for agents and environments, and the error explains what you'd lose: deleting an environment can't be undone, and archiving an agent also archives every deployment of it. Setting deletion_protection = false, applying, then destroying cleaned everything up.
Things to know before you use it at work
- It's a beta. Resource types and arguments can change. Commit
.terraform.lock.hclso you choose when to take a new version. - State holds your prompts. Terraform state and plan files store system prompts, tool schemas, memory contents and skill files in plain text. Treat state like the sensitive thing it is: a remote backend with encryption and access control.
- Secrets stay out of state, if you let them. Arguments ending in
_wo(such as vault credential secrets) are write-only and never saved to state. They need Terraform 1.11 or later, and you should feed them fromephemeralvariables so they don't land in a saved plan. - Use federation in pipelines. Anthropic recommends workload identity federation for CI rather than long-lived keys, and the provider can set up the federation pieces itself.
- Nothing moves. An agent can't move to another workspace, region or cloud. You recreate it, or import an existing one.
Why I'm excited: MiAi as code
This is where it gets personal. MiAi, my own AI portal, runs on hardware in my house today: a web app, a database, and an assistant built on Claude. Running it at home is cheap, which is exactly why I built it there. It's where I test ideas without a cloud bill ticking in the background.
With this provider, the Claude side of MiAi can be code too: the agent, its system prompt, its tools and its memory, versioned and reviewed like everything else. Terraform is cloud-agnostic, with providers for AWS, Google Cloud, Azure and the homelab gear I already run, so the same workflow can describe both the infrastructure MiAi runs on and the AI it runs. The resource blocks for each cloud are different, but the tool, the plan-and-apply process and the state stay the same.
That makes a nice path. Build and test on inexpensive infrastructure at home, and keep the costs down while things are still changing every day. When something is ready for real users, use Terraform to stand it up in a more robust cloud environment, with redundancy and scale that a box in my basement can't offer. The agent definition I tested at home is the same code that ships, so what I tested is what I deploy.
For anyone who lives in Terraform, an AI agent is now just another piece of infrastructure. That's what it looks like when friends join forces.