terraform-provider-stackgen

sg_chat_subscription (Resource)

⚠️ Experimental — Manages a Guild chat subscription that routes inbound Slack/Teams events to an agent or installed app.

Example Usage

# When to use: Route inbound Slack/Teams events (mention, message, alert_bot)
# to an agent or installed app. Select channels by operator tag and/or explicit
# Guild chat channel UUIDs from sg_chat_channel.
#
# Prerequisites: target agent/app exists; channels registered (sg_chat_channel
# or auto-enrolled via sg_chat_channel_rule) and tagged appropriately.
#
# Related: sg_chat_channel, sg_chat_channel_rule, sg_agent, sg_app.
resource "sg_chat_subscription" "sre_mentions" {
  name          = "sre-mention-router"
  target_type   = "agent"
  target_name   = "sre-investigator" # replace with sg_agent.*.name or app-managed agent
  trigger_types = ["mention", "message"]
  enabled       = true
  precedence    = 100

  channel_selector = {
    tag = "incidents"
    # channel_ids = [sg_chat_channel.incidents.id]
  }

  # Optional CEL gate — only fire when the message looks like an alert.
  # filter_cel = "event.text.contains(\"ALERT\")"
}

Import

Import an existing sg_chat_subscription using its subscription UUID:

terraform import sg_chat_subscription.example '123e4567-e89b-12d3-a456-426614174000'

Schema

Required

Optional

Read-Only

Nested Schema for channel_selector

Optional: