Skip to content

kupe_alertmanager_routes

Manages the entire ordered list of child routes on the root Alertmanager route for a tenant. Singleton — only one of these resources should exist per tenant. The root route itself (receiver, group_by defaults) is implicit and managed by kupe-api.

# Singleton-per-tenant route list. The root route itself (default receiver,
# default group_by) is implicit and managed by kupe-api; this resource owns
# the ordered list of child routes that branch off the root.
#
# Routes are evaluated top-to-bottom — the first match wins (unless `continue`
# is set on the matched route). Reordering, inserting, and removing routes are
# all atomic single-PUT operations because the resource owns the entire list.
resource "kupe_alertmanager_routes" "main" {
routes_json = jsonencode([
# Page on critical severity, day or night.
{
matchers = ["severity=\"critical\""]
receiver = "pagerduty"
group_wait = "10s"
group_interval = "5m"
repeat_interval = "1h"
},
# Slack-only for the infra team.
{
matchers = ["team=\"infra\""]
receiver = "slack"
},
# Catch-all for everything else — fall through to the default receiver
# by leaving `receiver` empty (inherits from the root).
{
matchers = ["severity=\"warning\""]
continue = true
},
])
# Make sure the receivers exist before this resource creates the routes.
# Without these explicit dependencies, terraform may try to write the
# routes first and the kupe-api validator will reject any references to
# missing receivers with a 400.
depends_on = [
kupe_alertmanager_receiver.slack,
kupe_alertmanager_receiver.pagerduty,
]
}
  • routes_json (String) Ordered list of routes as a JSON array. Use jsonencode([...]) to author. Each element follows the Alertmanager Route schema (receiver, matchers, group_by, group_wait, group_interval, repeat_interval, nested routes).
  • etag (String) Wrapper ETag from the most recent read or write. Used for optimistic locking on subsequent updates.
  • id (String) Always equal to the tenant name. Singleton-per-tenant resource.

Import is supported using the following syntax:

The terraform import command can be used, for example:

Terminal window
terraform import kupe_alertmanager_routes.main alertmanager-routes