Skip to content

kupe_alertmanager_routes

Manages the entire ordered list of child routes on the default notification route for a tenant. Define this resource once per tenant.

resource "kupe_alertmanager_receiver" "slack" {
name = "slack"
body_json = jsonencode({
slack_configs = [{
api_url = var.slack_webhook_url
channel = "#alerts"
}]
})
}
resource "kupe_alertmanager_receiver" "pagerduty" {
name = "pagerduty"
body_json = jsonencode({
pagerduty_configs = [{
service_key = var.pagerduty_service_key
}]
})
}
variable "slack_webhook_url" {
type = string
sensitive = true
}
variable "pagerduty_service_key" {
type = string
sensitive = true
}
resource "kupe_alertmanager_routes" "main" {
routes_json = jsonencode([
{
matchers = ["severity=\"critical\""]
receiver = "pagerduty"
group_wait = "10s"
group_interval = "5m"
repeat_interval = "1h"
},
{
matchers = ["team=\"infra\""]
receiver = "slack"
},
{
matchers = ["severity=\"warning\""]
continue = true
},
])
depends_on = [
kupe_alertmanager_receiver.slack,
kupe_alertmanager_receiver.pagerduty,
]
}
  • routes_json (String, Sensitive) Ordered list of routes as a JSON array. Use jsonencode([...]) to author. Each element follows the notification 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 singleton constant alertmanager-routes. 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