Dash0 acquires Polar Signals

Last updated:

dash0_notification_channel

Terraform resource for Dash0 notification channels — Slack, email, PagerDuty, Opsgenie, webhooks, Microsoft Teams, Discord, Google Chat, and routing rules.

Manages a Dash0 Notification Channel. Notification channels define how alerts are delivered to external systems such as Slack, PagerDuty, email, and webhooks. Notification channels are organization-level resources and are not scoped to a dataset.

See Send Alert Check Notifications and Route Alert Check Notifications for more details.

Supported channel types: slack (webhook), slack_bot, email_v2, pagerduty, opsgenie, webhook, teams_webhook, discord_webhook, google_chat_webhook.

Example Usage

terraform
# Slack webhook notification channel
resource "dash0_notification_channel" "slack_webhook" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Slack Alerts
spec:
  type: slack
  config:
    webhookURL: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
    channel: "#alerts"
  frequency: 10m
YAML
}

# Slack Bot notification channel
#
# Prerequisites:
#   1. Install the Dash0 Slack App via the Dash0 UI (Settings > Notification
#      Channels > Add Notification Channel > Slack Bot > Authorize). This is a
#      one-time operation per Slack workspace.
#   2. Invite the bot to the target channel: /invite @Dash0
#   3. The Dash0 bot must be explicitly added to each Slack channel it will post to.
#      In Slack, open the target channel and run `/invite @Dash0`. Repeat this for every channel
#      you want to receive notifications in.
resource "dash0_notification_channel" "slack_bot" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Slack Bot Alerts
spec:
  type: slack_bot
  config:
    teamId: "T012345"
    channel: "#alerts"
  frequency: 10m
YAML
}

# Email notification channel
resource "dash0_notification_channel" "email" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Email Alerts
spec:
  type: email_v2
  config:
    recipients:
      - oncall@example.com
      - sre-team@example.com
    plaintext: false
  frequency: 10m
YAML
}

# PagerDuty notification channel
resource "dash0_notification_channel" "pagerduty" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: PagerDuty Incidents
spec:
  type: pagerduty
  config:
    key: "my-pagerduty-integration-key"
    url: "https://events.pagerduty.com/v2/enqueue"
  frequency: 10m
YAML
}

# OpsGenie notification channel
resource "dash0_notification_channel" "opsgenie" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Opsgenie Alerts
spec:
  type: opsgenie
  config:
    apiKey: "my-opsgenie-api-key"
    instance: us
  frequency: 10m
YAML
}

# Generic webhook notification channel
resource "dash0_notification_channel" "webhook" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Webhook Alerts
spec:
  type: webhook
  config:
    url: "https://example.com/webhook/alerts"
  frequency: 10m
YAML
}

# Microsoft Teams notification channel
resource "dash0_notification_channel" "teams" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Microsoft Teams Alerts
spec:
  type: teams_webhook
  config:
    url: "https://example.webhook.office.com/webhookb2/..."
  frequency: 10m
YAML
}

# Discord notification channel
resource "dash0_notification_channel" "discord" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Discord Alerts
spec:
  type: discord_webhook
  config:
    url: "https://discord.com/api/webhooks/..."
  frequency: 10m
YAML
}

# Google Chat notification channel
resource "dash0_notification_channel" "google_chat" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Google Chat Alerts
spec:
  type: google_chat_webhook
  config:
    url: "https://chat.googleapis.com/v1/spaces/.../messages?key=..."
  frequency: 10m
YAML
}

# Webhook notification channel with routing rules
#
# Routing rules control which alerts are delivered to this channel.
# Each top-level list item is an OR group; conditions within a group are ANDed.
# In this example, notifications are sent when:
#   (team.name = "sre" AND deployment.environment.name = "production")
#   OR (service.severity = "critical")
#
# Note: `routing` also has an API-managed `assets` sibling — the Dash0 API populates it as a
# back-reference when a check rule or synthetic check binds to the channel, and discards any
# value supplied on write (the provider warns if you set it). Bind a check rule via its
# `dash0.com/notification-channel-ids` annotation, or a synthetic check via its
# `spec.notifications.channels`.
resource "dash0_notification_channel" "webhook_with_routing" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Production Alerts (Webhook with Routing)
spec:
  type: webhook
  config:
    url: "https://example.com/webhook/production-alerts"
  frequency: 5m
  routing:
    filters:
      - - key: team.name
          operator: is
          value: sre
        - key: deployment.environment.name
          operator: is
          value: production
      - - key: service.severity
          operator: is
          value: critical
YAML
}

# You can also load the YAML definition from a file:
#
# resource "dash0_notification_channel" "from_file" {
#   notification_channel_yaml = file("${path.module}/notification_channel.yaml")
# }

Notification Frequency

The frequency field in the notification channel spec controls how often reminder notifications are sent while an alert is firing.

Important behavior:

  • If frequency is not specified in your YAML, the Dash0 API applies a default value of 10m. This means you will receive reminder notifications every 10 minutes while the alert is active.
  • To disable reminder notifications (receive only the initial alert and resolution notification), explicitly set frequency: 0s.
  • Removing frequency from an existing configuration will not disable reminders — it will reset to the default 10m.

Example: disable reminders

terraform
resource "dash0_notification_channel" "no_reminders" {
  notification_channel_yaml = <<-YAML
kind: Dash0NotificationChannel
metadata:
  name: Alerts Without Reminders
spec:
  type: slack
  config:
    webhookURL: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
    channel: "#alerts"
  frequency: 0s
YAML
}

In this configuration, you will receive a notification when the alert fires and another when it resolves, but no reminder notifications in between.

Schema

Required

  • notification_channel_yaml (String) The notification channel definition in YAML format. The YAML must include kind: Dash0NotificationChannel, a metadata.name field, and a spec with type and type-specific config. Optional fields include frequency (controls reminder notification intervals; defaults to 10m if omitted; set to 0s to disable reminders) and routing for filtering which alerts are delivered. Note that spec.routing.assets is populated by the Dash0 API as a back-reference when a check rule or synthetic check binds to this channel by id, and is discarded if supplied on write; bind a check rule by setting the dash0.com/notification-channel-ids annotation on the rule, or a synthetic check by setting spec.notifications.channels on the synthetic check. See Send Alert Check Notifications for the available options.

Read-Only

  • id (String) The server-assigned UUID of the notification channel, resolved by the provider after creation. Reference this value when wiring the channel into another resource's YAML — for example, in a dash0_synthetic_check's spec.notifications.channels list, which requires raw UUIDs rather than origins.
  • origin (String) A unique identifier for the notification channel, automatically generated on creation. Used to reference the notification channel for updates, reads, deletes, and imports.
  • url (String) The URL to open this notification channel in the Dash0 web app, derived from the Dash0 API URL and the channel's server-assigned identifier. Computed by the provider after creation. May be empty if the app URL cannot be derived (e.g. for self-hosted deployments with a custom web app domain).

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

shell
#!/bin/bash
terraform import dash0_notification_channel.name "{{ id_or_origin }}"