> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devhelm.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Terraform Alert Channels

> Define DevHelm alert channels with the devhelm_alert_channel Terraform resource

The `devhelm_alert_channel` resource creates and manages alert channel integrations in Terraform.

## Basic example

```hcl theme={null}
resource "devhelm_alert_channel" "slack" {
  name         = "Engineering Slack"
  channel_type = "slack"
  webhook_url  = var.slack_webhook_url
  mention_text = "@channel"
}
```

## Arguments

| Attribute           | Type         | Required | Description                                                                                                                                                                                                                                             |
| ------------------- | ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`              | string       | Yes      | Channel display name (also used as import ID)                                                                                                                                                                                                           |
| `channel_type`      | string       | Yes      | One of 20 types: `slack`, `email`, `pagerduty`, `opsgenie`, `discord`, `teams`, `webhook`, `telegram`, `google_chat`, `pushover`, `mattermost`, `splunk_oncall`, `pushbullet`, `linear`, `incident_io`, `rootly`, `zapier`, `datadog`, `jira`, `gitlab` |
| `webhook_url`       | string       | —        | Incoming webhook URL (required for `slack`, `discord`, `teams`, `google_chat`, `mattermost`, `zapier`)                                                                                                                                                  |
| `mention_text`      | string       | —        | Slack mention text (e.g., `@channel`)                                                                                                                                                                                                                   |
| `mention_role_id`   | string       | —        | Discord role ID to mention                                                                                                                                                                                                                              |
| `recipients`        | list(string) | —        | Email addresses (required for `email`)                                                                                                                                                                                                                  |
| `routing_key`       | string       | —        | Routing/integration key (required for `pagerduty` and `splunk_oncall`, sensitive)                                                                                                                                                                       |
| `severity_override` | string       | —        | PagerDuty severity override                                                                                                                                                                                                                             |
| `api_key`           | string       | —        | Service API key (required for `opsgenie`, `splunk_oncall`, `linear`, `incident_io`, `rootly`, `datadog`; sensitive)                                                                                                                                     |
| `region`            | string       | —        | OpsGenie region (`us` or `eu`)                                                                                                                                                                                                                          |
| `url`               | string       | —        | Endpoint URL (required for `webhook`)                                                                                                                                                                                                                   |
| `custom_headers`    | map(string)  | —        | Custom HTTP headers for webhook delivery                                                                                                                                                                                                                |
| `signing_secret`    | string       | —        | HMAC signing secret for webhook payloads (sensitive)                                                                                                                                                                                                    |
| `bot_token`         | string       | —        | Telegram bot token from @BotFather (required for `telegram`, sensitive)                                                                                                                                                                                 |
| `chat_id`           | string       | —        | Telegram chat, group, or channel ID (required for `telegram`)                                                                                                                                                                                           |
| `user_key`          | string       | —        | Pushover user or group key (required for `pushover`, sensitive)                                                                                                                                                                                         |
| `app_token`         | string       | —        | Pushover application API token (required for `pushover`, sensitive)                                                                                                                                                                                     |
| `priority`          | string       | —        | Pushover notification priority override (-2 to 2)                                                                                                                                                                                                       |
| `sound`             | string       | —        | Pushover notification sound override                                                                                                                                                                                                                    |
| `channel`           | string       | —        | Mattermost override channel (if webhook allows)                                                                                                                                                                                                         |
| `icon_url`          | string       | —        | Custom bot icon URL for Mattermost                                                                                                                                                                                                                      |
| `access_token`      | string       | —        | Pushbullet access token (required for `pushbullet`, sensitive)                                                                                                                                                                                          |
| `device_iden`       | string       | —        | Pushbullet target device (broadcasts to all if empty)                                                                                                                                                                                                   |
| `team_id`           | string       | —        | Linear team ID to create issues in (required for `linear`)                                                                                                                                                                                              |
| `label_id`          | string       | —        | Linear label ID to attach to created issues                                                                                                                                                                                                             |
| `severity_id`       | string       | —        | Incident.io severity ID for created incidents                                                                                                                                                                                                           |
| `visibility`        | string       | —        | Incident.io incident visibility: `public` or `private`                                                                                                                                                                                                  |
| `severity`          | string       | —        | Rootly severity slug override (e.g. `sev0`, `sev1`)                                                                                                                                                                                                     |
| `site`              | string       | —        | Datadog site region (e.g. `datadoghq.com`, `datadoghq.eu`)                                                                                                                                                                                              |
| `tags`              | string       | —        | Datadog comma-separated tags to attach to events                                                                                                                                                                                                        |
| `domain`            | string       | —        | Atlassian instance domain (required for `jira`)                                                                                                                                                                                                         |
| `email`             | string       | —        | Atlassian account email (required for `jira`)                                                                                                                                                                                                           |
| `api_token`         | string       | —        | Atlassian API token (required for `jira`, sensitive)                                                                                                                                                                                                    |
| `project_key`       | string       | —        | Jira project key where issues are created (required for `jira`)                                                                                                                                                                                         |
| `issue_type`        | string       | —        | Jira issue type name (e.g. `Bug`, `Task`, `Incident`)                                                                                                                                                                                                   |
| `endpoint_url`      | string       | —        | GitLab alert integration endpoint URL (required for `gitlab`)                                                                                                                                                                                           |
| `authorization_key` | string       | —        | GitLab alert integration authorization key (required for `gitlab`, sensitive)                                                                                                                                                                           |

<Note>
  The provider enforces a per-type field matrix at plan time: attributes
  required by the chosen `channel_type` must be set, and attributes belonging
  to a *different* channel type are rejected with "Unsupported attribute for
  channel type" rather than silently dropped.
</Note>

### Computed attributes

| Attribute     | Description                               |
| ------------- | ----------------------------------------- |
| `id`          | Channel ID                                |
| `config_hash` | Content hash of the channel configuration |

## Examples by type

<CodeGroup>
  ```hcl Slack theme={null}
  resource "devhelm_alert_channel" "slack" {
    name         = "Slack Alerts"
    channel_type = "slack"
    webhook_url  = var.slack_webhook_url
    mention_text = "@here"
  }
  ```

  ```hcl PagerDuty theme={null}
  resource "devhelm_alert_channel" "pagerduty" {
    name         = "PagerDuty On-Call"
    channel_type = "pagerduty"
    routing_key  = var.pagerduty_routing_key
  }
  ```

  ```hcl Email theme={null}
  resource "devhelm_alert_channel" "email" {
    name         = "Ops Email"
    channel_type = "email"
    recipients   = ["ops@example.com", "oncall@example.com"]
  }
  ```

  ```hcl Webhook theme={null}
  resource "devhelm_alert_channel" "webhook" {
    name           = "Custom Webhook"
    channel_type   = "webhook"
    url            = "https://hooks.example.com/devhelm"
    signing_secret = var.webhook_secret
    custom_headers = { "X-Source" = "devhelm" }
  }
  ```
</CodeGroup>

## Import

```bash theme={null}
terraform import devhelm_alert_channel.slack "Slack Alerts"
```

Import accepts the channel **name** or its **UUID**. If multiple channels share the same name, the import fails with an ambiguity error — import by UUID in that case.

## Next steps

<CardGroup cols={2}>
  <Card title="Monitors" icon="signal" href="/mac/terraform/monitors">
    Reference channels from monitor resources.
  </Card>

  <Card title="Integrations" icon="puzzle-piece" href="/integrations/overview">
    Setup guides for each channel type.
  </Card>
</CardGroup>
