---
title: Terraform 프로바이더
url: https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform
description: Anthropic Terraform 프로바이더를 설치하고, 로그인한 다음, 첫 번째 구성을 apply하세요.
---

Anthropic Terraform 프로바이더는 Claude Platform 리소스를 코드로 관리합니다. 리소스 변경 사항은 다른 인프라와 동일한 검토, plan, apply 워크플로를 거칩니다.

<Note>
  Terraform 프로바이더는 베타 단계입니다. 베타 기간 동안 리소스 유형과 그 인수가 변경될 수 있습니다. [잠금 파일을 커밋](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/operations#pin-the-providers-release)하여 변경 사항을 적용할 시점을 직접 선택하세요.
</Note>

## 요구 사항

* [Terraform 1.11 이상](https://developer.hashicorp.com/terraform/install)
* [`ant` CLI](https://platform.claude.com/docs/ko/cli-sdks-libraries/cli/quickstart#installation)
* Managed Agents 리소스의 경우, [Claude Managed Agents](https://platform.claude.com/docs/ko/managed-agents/overview)에 대한 액세스 권한이 있는 조직

## provider 블록 추가하기

`terraform init`은 [Terraform Registry](https://registry.terraform.io/providers/anthropics/anthropic/latest/docs)에서 프로바이더를 설치합니다.

빈 디렉터리에서 `terraform` 블록과 provider 블록이 있는 `main.tf`를 생성하세요:

```hcl
terraform {
  required_providers {
    anthropic = {
      source = "anthropics/anthropic"
    }
  }
}

variable "organization_id" {
  type = string
}

# 이 구성을 하나의 조직에 고정합니다. 모든 plan은 자격 증명이
# 해당 조직에 속하는지 확인하며, 그렇지 않으면 진행을 거부합니다.
provider "anthropic" {
  organization_id = var.organization_id
}
```

`anthropics/anthropic`은 이 프로바이더의 유일한 공식 소스 주소입니다. 프로바이더는 Anthropic 자격 증명에 접근할 수 있는 상태로 실행되므로, 다른 주소에서 설치한 프로바이더는 자격 증명을 읽을 수 있습니다.

## 환경과 에이전트 추가하기

`main.tf`에 다음 블록을 추가하세요.

이 예제는 프로바이더 리포지토리의 [`managed-agents/quickstart`](https://github.com/anthropics/terraform-provider-anthropic/tree/main/examples/managed-agents/quickstart) 예제를 기반으로 합니다. 이 예제는 [제한된 네트워킹](https://platform.claude.com/docs/ko/managed-agents/environments#networking)을 사용하는 환경과 웹 검색 및 웹 가져오기가 꺼진 에이전트를 생성하고, 세션에 필요한 ID에 대한 출력을 정의합니다:

```hcl
# 에이전트의 도구가 실행되는 위치: 격리된 클라우드 컨테이너입니다.
# 패키지 관리자를 허용한 제한된 네트워킹을 통해 패키지 레지스트리와
# 코드 호스트에만 접근할 수 있습니다.
resource "anthropic_beta_environment" "sandbox" {
  name        = "quickstart"
  description = "Cloud sandbox for the quickstart agent."

  config = {
    cloud = {
      networking = {
        limited = {
          allow_package_managers = true
        }
      }
    }
  }
}

# 에이전트는 모델, 시스템 프롬프트, 도구를 하나로 묶습니다. 변경할 때마다
# 서버 측에 새 버전이 게시되며, 버전 고정을 위해 `version`이
# 내보내집니다.
resource "anthropic_beta_agent" "assistant" {
  name        = "quickstart-assistant"
  description = "General-purpose assistant with the built-in toolset."

  model = {
    id = "claude-opus-5-5"
  }

  system = "You are a concise, careful assistant."

  # 환경의 제한된 네트워킹은 웹 검색과 웹 가져오기에도
  # 적용됩니다. `allowed_hosts`가 없으면 페이지나 검색 결과를 반환하지 않으므로
  # 비활성화되어 있습니다.
  tools = [
    {
      agent_toolset_20260401 = {
        configs = [
          { web_search = { enabled = false } },
          { web_fetch = { enabled = false } },
        ]
      }
    },
  ]
}

output "agent_id" {
  value = anthropic_beta_agent.assistant.id
}

output "environment_id" {
  value = anthropic_beta_environment.sandbox.id
}
```

## 로그인하고 apply하기

터미널에서 `ant auth login`으로 로그인하세요. 이 명령은 로그인 정보를 이름이 지정된 구성 파일인 프로필에 저장합니다. 프로바이더는 해당 프로필을 사용합니다. 셸에서 `ANTHROPIC_API_KEY` 또는 `ANTHROPIC_AUTH_TOKEN`을 export하고 있다면 `unset`으로 셸에서 해당 변수를 제거하세요. [조회 순서](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/behavior#credential-lookup-order)에 나와 있듯이, 두 변수 모두 로그인보다 우선합니다.

조직 ID는 Claude Console의 [조직 설정](https://platform.claude.com/settings/organization) 페이지 또는 `ant auth status`의 출력에서 확인하세요.

```bash
ant auth login
export TF_VAR_organization_id="00000000-0000-0000-0000-000000000000"

terraform init
terraform plan
terraform apply
```

## 변경 사항이 없는지 확인하기

apply 후에 `terraform plan`을 한 번 더 실행하세요. `No changes`가 보고되어야 합니다. 직접 하지 않은 변경 사항이 제안되면 [버그로 보고](https://github.com/anthropics/terraform-provider-anthropic/issues)하세요.

## 정리하기

[삭제 보호](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/behavior#deletion-protection)는 기본적으로 켜져 있으므로, 이를 끄기 전까지 `terraform destroy`는 오류와 함께 중단됩니다. 생성한 것을 제거하려면:

1. 두 리소스 블록 모두에 `deletion_protection = false`를 추가하고 `terraform apply`를 실행하세요.
2. `terraform destroy`를 실행하세요. 이렇게 하면 환경이 삭제되고 [에이전트가 아카이브됩니다](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/behavior#managed-agents-resources).

## 추가 리소스

* [Terraform 프로바이더 인증하기](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/authentication): 파이프라인, 터미널, 여러 ID
* [예제: 팀의 워크스페이스와 CI ID](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/authentication#example-a-teams-workspace-and-ci-identity): 조직 리소스와 이에 필요한 로그인
* [조직 리소스](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/behavior#organization-resources): 각 리소스와 destroy가 각 리소스에 미치는 영향
* [Managed Agents 리소스](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/behavior#managed-agents-resources): 각 리소스와, Terraform에서 이를 보여주는 Managed Agents 페이지
* [Terraform 프로바이더 운영하기](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/operations): import, 안전한 state, 로그 등 첫 apply 이후의 작업
* [Terraform 프로바이더의 동작 방식](https://platform.claude.com/docs/ko/cli-sdks-libraries/sdks/terraform/behavior): 자격 증명, destroy의 동작, state에 저장되는 내용
* [GitHub 리포지토리](https://github.com/anthropics/terraform-provider-anthropic)
* [Terraform Registry](https://registry.terraform.io/providers/anthropics/anthropic/latest/docs)
