--- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "Anthropic Provider" description: |- The Anthropic provider manages resources in your Anthropic organization, such as workspaces and service accounts. It also manages Claude Managed Agents resources, such as agents, environments, and vaults. --- # Anthropic Provider -> **Public beta.** This provider is beta pre-release software, provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the Beta Services section of the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). As we continue development, there may be breaking changes that require updates to your configuration. **We'd love your feedback!** Please share any suggestions, bug reports, feature requests, or general thoughts by [filing an issue](https://github.com/anthropics/terraform-provider-anthropic/issues/new). The Anthropic provider manages resources in your Anthropic organization, such as workspaces and service accounts. It also manages Claude Managed Agents resources, such as agents, environments, and vaults. For a guided setup, see [Terraform provider](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/terraform) in the Claude Platform docs. ## Installation ```terraform terraform { required_providers { anthropic = { source = "anthropics/anthropic" } } } ``` You need [Terraform](https://developer.hashicorp.com/terraform/install) 1.0 or later (1.11 or later to set write-only secrets). `anthropics/anthropic` is the only official source address for this provider. A provider runs with access to your Anthropic credentials, and one installed from any other address could read them. ## Example Usage ```terraform provider "anthropic" { # The organization to manage. `ant auth status` shows its ID. organization_id = "00000000-0000-0000-0000-000000000000" # Optional: also pins the workspace the resources live in. # workspace_id = "wrkspc_00000000000000000000000" } # A second credential. Set `provider = anthropic.research` on a resource to use it. provider "anthropic" { alias = "research" organization_id = "00000000-0000-0000-0000-000000000000" profile = "research" # ant auth login --profile research } ``` ## Authentication With the default `platform`, a provider block uses the first of these credentials that is set: 1. `api_key`, `auth_token`, or `profile` in the block 2. `ANTHROPIC_API_KEY` 3. `ANTHROPIC_AUTH_TOKEN` 4. The [`ant` CLI](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart) profile named by `ANTHROPIC_PROFILE` 5. Workload identity federation: `ANTHROPIC_FEDERATION_RULE_ID`, `ANTHROPIC_ORGANIZATION_ID`, and `ANTHROPIC_IDENTITY_TOKEN_FILE`. In CI, use a federation profile instead of these variables. 6. The `ant` CLI's active profile The credential you need depends on the resource: | Resources | Credential | | --- | --- | | Workspaces, workspace members, external keys, telemetry destinations, and organization webhooks | An Admin API key or a profile with the `org:admin` scope | | Service accounts and federation | A profile with the `org:admin` scope | | RBAC, plugin marketplaces, and Claude Tag | An [Enterprise Admin API key](https://platform.claude.com/docs/en/manage-claude/admin-api-keys#create-a-key-for-a-claude-enterprise-organization) with that feature's [scopes](https://platform.claude.com/docs/en/manage-claude/enterprise-admin-api-key-scopes) | | Claude Managed Agents | An API key or profile for the workspace | | MCP tunnels and their certificates | A federation profile with the `workspace:manage_tunnels` or `org:admin` scope | To set up a profile, a CI pipeline, or several identities, see [Authenticate the Terraform provider](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/terraform/authentication). For other kinds of keys and their limits, see [Credentials for each resource](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/terraform/behavior#credentials-for-each-resource). ## Security - **State and plans.** Terraform state and plan output contain your configuration in plain text, including system prompts, tool schemas, memory content, and inline skill files. To protect both, see [Manage sensitive data](https://developer.hashicorp.com/terraform/language/manage-sensitive-data). - **Secrets.** Arguments that end in `_wo`, such as vault credential secrets, are write-only and never stored in state. A saved plan still contains any secret written in your configuration or passed through an ordinary variable, so pass secrets through variables declared with `ephemeral = true`. - **MCP server URLs.** State contains the MCP server URLs of every agent that Terraform reads, including the agents that `anthropic_beta_agents` lists. Put tokens in a vault credential instead of the URL. - **Credentials on the machine.** Provisioners, `external` data sources, and other providers can read the Anthropic credentials in your environment and in `~/.config/anthropic`. Run only configurations and modules that you trust. - **Least privilege.** Prefer workload identity federation or a key scoped to one workspace. With an organization-level credential, pin every module's version, commit `.terraform.lock.hcl`, and review changes to both. ## AWS and Google Cloud Set `platform` to manage resources on Claude Models on Google Cloud (Anthropic managed) or Claude Platform on AWS. Both need the `workspace_id` of an existing workspace and use your cloud credentials. For setup, see [Cloud platforms](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/terraform/authentication#cloud-platforms). ```terraform provider "anthropic" { platform = "aws" aws_region = "us-east-1" aws_account_id = "123456789012" workspace_id = "wrkspc_01..." } ``` ```terraform provider "anthropic" { platform = "google_cloud" google_cloud_project = "my-project" workspace_id = "wrkspc_01..." } ``` For the resources that each platform supports, see [Resources on each cloud platform](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/terraform/behavior#resources-on-each-cloud-platform). ## Amazon Bedrock Set `platform = "bedrock"` to manage Claude Managed Agents on Amazon Bedrock. Only `anthropic_beta_bedrock_agent`, `anthropic_beta_bedrock_memory_store`, `anthropic_beta_bedrock_memory`, and their data sources are available there, and they aren't available on any other platform. ```terraform provider "anthropic" { platform = "bedrock" aws_region = "us-east-1" aws_account_id = "123456789012" workspace_id = "proj_example" } ``` - **Credentials.** The provider uses the AWS default credential chain, or `aws_profile`, and stops if the credentials belong to another account. Unset `AWS_BEARER_TOKEN_BEDROCK`: Claude Managed Agents doesn't accept an Amazon Bedrock API key, so the provider stops if it's set. - **Availability.** If your AWS account doesn't have Claude Managed Agents in `aws_region`, or the project doesn't exist, a run that reads or deletes a resource stops with `Cannot tell whether the resource exists` and keeps the resource in state. - **Project.** `workspace_id` is the Amazon Bedrock project ID: `default` or a `proj_...` ID. It defaults to `default`, so adding or removing `workspace_id = "default"` changes nothing. The provider doesn't check that the project exists. - **Other settings.** `organization_id`, `profile`, `api_key`, `auth_token`, and `base_url` aren't available. The provider ignores `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and `ANTHROPIC_BASE_URL`, and stops if `ANTHROPIC_BEDROCK_BASE_URL` is set. - **Unchecked accounts.** With `aws_account_id = "unchecked"`, the provider can't tell whether a resource belongs to another AWS account. ## Moving resources A resource can't move to another platform, cloud account, project, or region. Agents, skills, tunnels, and the other resources inside a workspace can't move to another workspace. Recreate the resource in the new location, or remove it with `terraform state rm` and import one that already exists there. ## Schema ### Optional - `api_key` (String, Sensitive) An API key or Admin API key. Can also be set with the `ANTHROPIC_API_KEY` environment variable (`ANTHROPIC_AWS_API_KEY` when `platform` is `aws`). Not available when `platform` is `google_cloud` or `bedrock`. Conflicts with `auth_token` and `profile`. - `auth_token` (String, Sensitive) A bearer token, a Google access token when `platform` is `google_cloud`, or an API key when `platform` is `aws`. Can also be set with the `ANTHROPIC_AUTH_TOKEN` environment variable when `platform` is `anthropic`. Not available when `platform` is `bedrock`. Conflicts with `api_key` and `profile`. - `aws_account_id` (String) The ID of the AWS account to manage. Required when `platform` is `aws` or `bedrock`. The provider stops if the credentials belong to another account. Set to `unchecked` to skip the check. When `platform` is `aws`, an API key requires `unchecked`. - `aws_profile` (String) The AWS profile to sign requests with when `platform` is `aws` or `bedrock`. Defaults to the AWS default credential chain. - `aws_region` (String) The AWS region of the workspace, or of Amazon Bedrock. Required when `platform` is `aws` or `bedrock`. - `base_url` (String) The API base URL. Can also be set with the `ANTHROPIC_BASE_URL` environment variable. Conflicts with `profile`. Applies only when `platform` is `anthropic`. - `betas` (List of String) Values to send in the `anthropic-beta` header for every resource and data source that has a `betas` attribute, in addition to that attribute's values. - `google_cloud_location` (String) The Google Cloud location when `platform` is `google_cloud`. Defaults to `global`. - `google_cloud_project` (String) The Google Cloud project ID. Required when `platform` is `google_cloud`. - `organization_id` (String) The UUID of the organization to manage, shown in the Claude Console settings and by `ant auth status`. Required when `platform` is `anthropic` and not allowed otherwise. The provider stops if the credentials belong to another organization. Set to `unchecked` to skip the check. - `platform` (String) Where to manage resources: `anthropic` (the default), `aws` for Claude Platform on AWS, `google_cloud` for Claude Models on Google Cloud (Anthropic managed), or `bedrock` for Amazon Bedrock. - `profile` (String) The name of an `ant` CLI or workload identity federation profile. The block uses this profile and ignores `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN`. Conflicts with `api_key`, `auth_token`, and `base_url`. Applies only when `platform` is `anthropic`. - `workspace_id` (String) The `wrkspc_...` ID of the workspace to manage. Required when `platform` is `aws` or `google_cloud`. The provider stops if the credentials are for another workspace. Omit it for an organization-level credential. When `platform` is `bedrock`, the Amazon Bedrock project ID instead: a `proj_...` ID, or `default` (used when unset). The provider doesn't check that the project exists.