> For the complete documentation index, see [llms.txt](https://docs.panther.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.panther.com/ko/panther/terraform/log-source-alarms.md).

# Terraform을 사용한 로그 소스 알람 관리

## 개요

다음을 정의할 수 있습니다 [드롭오프 알람](/ko/data-onboarding/monitoring-log-sources.md#viewing-the-log-source-health) Panther를 사용하여 Terraform에서 로그 소스에 대한 [Terraform 공급자](https://registry.terraform.io/providers/panther-labs/panther/latest). 드롭오프 알람은 로그 소스가 설정된 시간 간격 동안 이벤트를 수신하지 않을 때 발생합니다. Terraform에서 알람을 정의하면 Panther 인프라의 나머지 부분과 함께 로그 소스 모니터링을 관리할 수 있습니다.

드롭오프 알람을 구성하는 다른 방법에는 다음이 포함됩니다 [Panther REST API 사용](/ko/panther/api/rest/log-source-alarms.md) 직접 [Panther Console에서 수동 구성](/ko/system-configuration/notifications/system-errors.md#configuring-log-drop-off-alarms-for-log-sources).

{% hint style="info" %}
SCIM 쿼리에서는 `SOURCE_NO_DATA` 알람 유형은 사용자가 구성할 수 있습니다. Panther Console에 보이는 다른 알람 유형(권한 확인, 분류 실패, 로그 처리 오류, 스캔 오류)은 시스템에서 관리되며 Terraform에서 정의할 수 없습니다.
{% endhint %}

## Terraform에서 로그 소스 알람을 정의하는 방법

다음 섹션에서는 HashiCorp Configuration Language(HCL)에서 드롭오프 알람을 정의하는 방법을 설명합니다.

### 사전 요구 사항

* 시작하기 전에 다음이 준비되어 있는지 확인하세요:
  * 다음 권한이 있는 API URL과 토큰 `로그 소스 관리` 권한. 이는 완료하는 데 필요합니다 [2단계](#step-2-provide-values-for-the-defined-variables).
    * 필요한 경우, 다음을 따르세요 [Panther Console에서 API 토큰을 생성하는 방법에 대한 이 지침](/ko/panther/api.md#how-to-create-a-panther-api-token).
  * 알람을 연결할 기존 Panther 로그 소스가 있으며, 동일한 Terraform 구성에 정의되었거나 ID로 참조됩니다. 다음 Terraform 페이지를 참조하세요: [S3](/ko/panther/terraform/s3.md), [HTTP](/ko/panther/terraform/http.md), [GCS](/ko/panther/terraform/gcs.md), 또는 [Pub/Sub](/ko/panther/terraform/pubsub.md) 로그 소스.

### 1단계: 변수 정의

* 다음 파일을 정의하세요 `다음 AWS 및 Panther 변수가 포함된 variables.tf` 아래 코드 블록에 표시된 Panther 변수가 포함된 파일을

```hcl
variable "panther_api_token" {
  description = "Panther API 토큰"
  type        = string
  sensitive   = true
}

variable "panther_api_url" {
  description = "Panther API URL"
  type        = string
}

variable "minutes_threshold" {
  description = "Panther가 이벤트를 수신하지 않았을 때 경고하기 전에 대기하는 시간(분)입니다. 15에서 43,200(30일) 사이여야 합니다."
  type        = number
  default     = 60
}
```

### 2단계: 정의한 변수에 값 제공

* 다음을 추가하세요 `*.tfvars` 파일을 추가하여 1단계에서 정의한 변수에 값을 할당하세요. 이 섹션을 완료하려면, 다음의 전제 조건 섹션에 설명된 API URL과 토큰이 필요합니다 [필수 조건 섹션](#prerequisites).
  * 사용자의 `panther_api_url` 값은 루트 API URL이어야 합니다. 이는 다음 중 하나입니다:
    * A [GraphQL API URL](/ko/panther/api/graphql.md#step-1-identify-your-panther-graphql-api-url) 다음 없이 `/public/graphql` 접미사
    * A [REST API URL](/ko/panther/api/rest.md#step-1-identify-your-panther-rest-api-url) 그대로 사용 (REST URL에는 루트 URL 뒤에 접미사가 없습니다)

```hcl
panther_api_token = "XXXXXXXXXX"
panther_api_url   = "https://your-panther-url/v1"
minutes_threshold = 60
```

### 3단계: Terraform 공급자 정의

* 다음을 추가하세요 [Panther](https://registry.terraform.io/providers/panther-labs/panther/latest) Terraform 공급자.

```hcl
terraform {
  required_providers {
    panther = {
      source  = "panther-labs/panther"
      version = "~> 0.2.12"
    }
  }
}
```

### 4단계: Panther 로그 소스 알람 리소스 정의

다음 HCL 구성은 기존 로그 소스에 대한 드롭오프 알람을 정의합니다. 예제는 다음을 가정합니다: `panther_s3_source` 라는 이름의 `demo_source` 는 구성의 다른 곳에 정의되어 있습니다. 동일한 `source_id` 패턴은 모든 로그 소스 유형에 적용됩니다([`panther_httpsource`](/ko/panther/terraform/http.md), [`panther_gcssource`](/ko/panther/terraform/gcs.md), [`panther_pubsubsource`](/ko/panther/terraform/pubsub.md)).

```hcl
provider "panther" {
  token = var.panther_api_token
  url   = var.panther_api_url
}

resource "panther_log_source_alarm" "demo_alarm" {
  source_id         = panther_s3_source.demo_source.id
  type              = "SOURCE_NO_DATA"
  minutes_threshold = var.minutes_threshold
}
```

{% hint style="info" %}
`source_id` 그리고 `유형` 변경할 수 없습니다. 생성 후 둘 중 하나라도 변경하면 Terraform이 알람을 삭제하고 다시 생성합니다.
{% endhint %}

## 리소스 참조

### `panther_log_source_alarm`

#### 인수

| 이름                  | 유형     | 필수 | 설명                                                                                   |
| ------------------- | ------ | -- | ------------------------------------------------------------------------------------ |
| `source_id`         | string | ✓  | 알람을 연결할 로그 소스의 ID입니다. 변경할 수 없으며, 이 값을 변경하면 리소스가 교체됩니다.                               |
| `유형`                | string | ✓  | 알람 유형입니다. 현재는 `SOURCE_NO_DATA` 만 지원됩니다. 변경할 수 없으며, 이 값을 변경하면 리소스가 교체됩니다.             |
| `minutes_threshold` | number | ✓  | Panther가 이벤트를 수신하지 않았을 때 경고하기 전에 대기하는 시간(분)입니다. 다음 사이여야 합니다: `15` 그리고 `43200` (30일). |

#### 속성

| 이름   | 유형     | 설명                                   |
| ---- | ------ | ------------------------------------ |
| `id` | string | 다음 형식의 복합 식별자: `{source_id}/{type}`. |

## 기존 로그 소스 알람 가져오기

Terraform으로 관리하려는 기존 Panther 드롭오프 알람이 있다면 다음을 사용하세요: `terraform import` 복합 `{source_id}/{type}` 식별자를 사용하세요.

```shell
terraform import panther_log_source_alarm.demo_alarm "12345678-1234-1234-1234-123456789012/SOURCE_NO_DATA"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.panther.com/ko/panther/terraform/log-source-alarms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
