Skip to content

Latest commit

 

History

History
158 lines (122 loc) · 5.09 KB

File metadata and controls

158 lines (122 loc) · 5.09 KB
page_title flashduty_channel Resource - flashduty
subcategory
description Manages a Flashduty channel.

flashduty_channel (Resource)

Manages a Flashduty channel.

Example Usage

# Create a team first
resource "flashduty_team" "sre" {
  team_name   = "SRE Team"
  description = "Site Reliability Engineering team"
}

# Basic channel
resource "flashduty_channel" "basic" {
  channel_name = "Production Alerts"
  description  = "Channel for production environment alerts"
  team_id      = tonumber(flashduty_team.sre.id)
}

# Channel with alert grouping (intelligent mode)
resource "flashduty_channel" "with_intelligent_grouping" {
  channel_name = "API Service Alerts"
  description  = "Alerts from API services with intelligent grouping"
  team_id      = tonumber(flashduty_team.sre.id)

  group = {
    method            = "i"
    time_window       = 10
    i_score_threshold = 0.85
    i_keys            = ["title", "description", "labels.service"]
    storm_thresholds  = [100, 500]
  }
}

# Channel with rule-based grouping
resource "flashduty_channel" "with_rule_grouping" {
  channel_name = "Database Alerts"
  description  = "Database alerts with rule-based grouping"
  team_id      = tonumber(flashduty_team.sre.id)

  group = {
    method      = "p"
    time_window = 30
    equals      = [["title", "labels.host"]]

    cases = [
      {
        if = [
          {
            key  = "severity"
            oper = "IN"
            vals = ["Critical"]
          }
        ]
        equals = ["title", "labels.host", "labels.database"]
      }
    ]
  }

  flapping = {
    is_disabled = false
    max_changes = 5
    in_mins     = 60
    mute_mins   = 120
  }
}

# Channel with managing teams and auto-resolve
resource "flashduty_channel" "full" {
  channel_name         = "Infrastructure Alerts"
  description          = "Full-featured channel"
  team_id              = tonumber(flashduty_team.sre.id)
  is_private           = true
  auto_resolve_timeout = 3600
  auto_resolve_mode    = "trigger"
}

Schema

Required

  • channel_name (String) The name of the channel.
  • team_id (Number) The ID of the team that owns this channel.

Optional

  • auto_resolve_mode (String) Auto-resolve mode. Valid values: trigger, update.
  • auto_resolve_timeout (Number) Auto-resolve timeout in seconds (0-86400). If not set, auto-resolve is disabled.
  • description (String) The description of the channel.
  • disable_auto_close (Boolean) Whether to disable automatic incident closure. Defaults to false.
  • disable_outlier_detection (Boolean) Whether to disable outlier detection. Defaults to false.
  • flapping (Attributes) Incident flap detection configuration. (see below for nested schema)
  • group (Attributes) Alert grouping configuration. (see below for nested schema)
  • is_private (Boolean) Whether the channel is private. Defaults to false.
  • managing_team_ids (List of Number) IDs of managing teams (max 3). Managing teams take over edit permissions from the owning team.

Read-Only

  • id (String) The unique identifier of the channel.

Nested Schema for flapping

Required:

  • is_disabled (Boolean) Whether flap detection is disabled.

Optional:

  • in_mins (Number) Statistics time window in minutes (1-1440, default 60).
  • max_changes (Number) Max state changes within the time window (2-100, default 4).
  • mute_mins (Number) Mute window in minutes (0-1440, default 120). 0 means no muting.

Nested Schema for group

Required:

  • method (String) Grouping method: i (intelligent), p (pattern/rule-based), n (none).

Optional:

  • all_equals_required (Boolean) Whether all grouping dimensions must be present. Default false.
  • cases (Attributes List) Branch grouping rules (max 10). Matched top-down; first match determines grouping dimensions. (see below for nested schema)
  • equals (List of List of String) Default grouping dimensions (OR of AND groups). Used when no case matches.
  • i_keys (List of String) Fields for intelligent similarity scoring (e.g. title, description, labels.service).
  • i_score_threshold (Number) Similarity threshold for intelligent grouping (0.5-1.0, default 0.9).
  • storm_thresholds (List of Number) Alert storm warning thresholds (max 5 values, each 2-10000).
  • time_window (Number) Time window in minutes (0-60). 0 means merge until incident closes.

Nested Schema for group.cases

Required:

  • equals (List of String) Grouping dimensions (e.g. title, severity, labels.xxx).
  • if (Attributes List) Filter conditions (AND logic). (see below for nested schema)

Nested Schema for group.cases.if

Required:

  • key (String) Filter key (e.g. title, severity, labels.xxx).
  • oper (String) Operator: IN or NOTIN.
  • vals (List of String) The values to match.