타깃용 Terraform 패턴
타깃용 Terraform 패턴 (Terraform patterns for targets)
호스트, 호스트 카탈로그, 자격 증명 저장소를 정의했다면, Terraform 패턴으로 Boundary 타깃을 만들 수 있어요. 타깃은 사용자가 연결하는 리소스를 정의하며 SSH와 TCP 프로토콜, 주입 또는 브로커링된 자격 증명, 선택적 세션 녹화를 지원합니다.
이 페이지는 호스트, 호스트 카탈로그, 자격 증명 저장소를 이미 만들었다고 가정합니다 — 아직 안 만들었다면 연결된 사전 요구 페이지를 참고하세요.
본문
사전 요구 사항
이 문서는 독자가 다음을 갖추고 있다고 가정합니다:
- Terraform 기초에 대한 이해
- 기존 Boundary 설치
- Terraform Boundary 프로바이더 구성
- 정의된 호스트, 호스트 카탈로그, 자격 증명 저장소
- (선택) 세션 녹화를 활성화하려는 타깃을 위한 스토리지 정책과 스토리지 버킷 구성
타깃 구성
이 예시는 주입된(인젝션) 사용자 이름과 비밀번호가 있는 타깃을 만듭니다.
resource "boundary_target" "ssh_foo" {
name = "ssh_foo"
description = "SSH target"
scope_id = boundary_scope.project.id
# Declare the target type and connection port
type = "ssh"
default_port = "22"
# Declare the host set
host_source_ids = [
boundary_host_set.foo.id
]
# Declare the injected credentials
injected_application_credential_source_ids = [
boundary_credential_library_vault.example.id
]
# Enable session recording
enable_session_recording = true
storage_bucket_id = boundary_storage_bucket.aws_bucket.id
}
세션 녹화 구성
이 예시는 세션 녹화를 활성화하되, 브로커링된 자격 증명을 사용합니다.
| Credential source | How it works | Use when |
|---|---|---|
| Injected | Boundary가 세션에 자격 증명을 주입 | 클라이언트가 자격 증명 주입을 지원 |
| Brokered | Boundary가 클라이언트에 자격 증명을 전달 | 클라이언트가 자격 증명을 직접 관리해야 함 (예: RDP) |
resource "boundary_target" "ssh_foo" {
name = "ssh_foo"
description = "SSH target"
scope_id = boundary_scope.project.id
# Declare the target type and connection port
type = "ssh"
default_port = "22"
# Declare the host set
host_source_ids = [
boundary_host_set.foo.id
]
# Declare the brokered credentials
# This uses a static credential library created earlier
brokered_application_credential_source_ids = [
boundary_credential_library.example.id
]
# Enable session recording.
enable_session_recording = true
storage_bucket_id = boundary_storage_bucket.aws_bucket.id
}
TCP 타깃 구성
이 예시는 RDP(원격 데스크톱 프로토콜)로 Windows 서버에 연결하는 tcp 타깃을 만듭니다.
resource "boundary_target" "rdp_foo" {
name = "rdp_foo"
description = "RDP target"
scope_id = boundary_scope.project.id
# Declare the target type and connection port
type = "tcp"
default_port = "3389"
# Declare the host set. This assumes that this host set contains Windows hosts
host_source_ids = [
boundary_host_set.foo.id
]
# The credentials we will use to connect. RDP requires the use of brokered credentials
# This uses a static credential library created earlier
brokered_application_credential_source_ids = [
boundary_credential_library.example.id
]
}
관련 타깃 문서
이 주제에서 언급한 Boundary 리소스에 대한 자세한 내용은 도메인 모델 문서를 참고하세요:
Terraform으로 다음 리소스를 관리하는 방법에 대한 자세한 내용은 Boundary 프로바이더 문서를 참고하세요: