terraform-provider-stackgen

sg_webhook (Resource)

⚠️ Experimental — This resource is part of the Guild platform and may change in future releases.

Manages an incoming HTTP webhook that starts an sg_agent or sg_workflow run when triggered externally. Use target_type = agent or workflow and target_name = the agent or workflow name (same pairing as sg_agent_schedule).

The trigger token is sensitive and returned on create and whenever token_rotation changes.

Set provider workspace_id to create the webhook in the same workspace as agents, workflows, and schedules.

Example Usage

# When to use: Incoming HTTP webhook that triggers an agent or workflow run
# (PagerDuty, custom CI, etc.). For SRE Copilot alert ingest use
# sg_sre_alert_webhook instead — generic sg_webhook is insufficient for that path.
#
# Prerequisites: existing agent or workflow name; provider workspace_id for org scope.
#
# Related: sg_agent / sg_workflow, sg_notification_channel, sg_sre_alert_webhook.
resource "sg_webhook" "example" {
  name        = "incident-intake"
  target_type = "agent"
  target_name = "my-agent"
  action      = "Triage the incoming payload and extract severity and service."
  enabled     = true

  # Bump this string to rotate the trigger token in place (sensitive; stored in state).
  # token_rotation = "v2"
}

Import

Import an existing sg_webhook using its webhook UUID:

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

Operational notes

Import by webhook UUID. The trigger token may be omitted on later reads; preserve the create-time token in state and secure plans.

Schema

Required

Optional

Read-Only