новый модуль modules/grafana_irm_escalation, dev/adibrov подключён. секреты (oncall_access_token, user id) хранятся в Vault, в git не попадают
68 lines
2.8 KiB
HCL
68 lines
2.8 KiB
HCL
variable "name" {
|
||
description = "Название цепочки эскалации"
|
||
type = string
|
||
}
|
||
|
||
variable "team_id" {
|
||
description = "ID команды в Grafana IRM (опционально)"
|
||
type = string
|
||
default = null
|
||
}
|
||
|
||
variable "steps" {
|
||
description = <<-EOT
|
||
Шаги эскалации по порядку. position назначается автоматически (0, 1, 2...).
|
||
|
||
Доступные типы (type):
|
||
notify_persons — уведомить конкретных пользователей
|
||
notify_person_next_each_time — round-robin по списку
|
||
notify_on_call_from_schedule — кто сейчас на дежурстве по расписанию
|
||
notify_user_group — уведомить группу пользователей
|
||
notify_team_members — уведомить команду
|
||
wait — пауза (duration_seconds секунд)
|
||
trigger_webhook — вызвать webhook
|
||
resolve — авторезолв инцидента
|
||
repeat_escalation — повторить цепочку с начала
|
||
|
||
Пример:
|
||
steps = [
|
||
{ type = "notify_on_call_from_schedule", notify_on_call_from_schedule = "<schedule_id>" },
|
||
{ type = "wait", duration_seconds = 300 },
|
||
{ type = "notify_persons", persons_to_notify = ["<user_id>"] },
|
||
{ type = "repeat_escalation" },
|
||
]
|
||
EOT
|
||
type = list(object({
|
||
type = string
|
||
duration_seconds = optional(number, null)
|
||
persons_to_notify = optional(list(string), null)
|
||
persons_to_notify_next_each_time = optional(list(string), null)
|
||
notify_on_call_from_schedule = optional(string, null)
|
||
group_to_notify = optional(string, null)
|
||
action_to_trigger = optional(string, null)
|
||
notify_to_team_members = optional(string, null)
|
||
important = optional(bool, false)
|
||
}))
|
||
|
||
validation {
|
||
condition = alltrue([
|
||
for s in var.steps : contains([
|
||
"notify_persons",
|
||
"notify_person_next_each_time",
|
||
"notify_on_call_from_schedule",
|
||
"notify_user_group",
|
||
"notify_team_members",
|
||
"wait",
|
||
"trigger_webhook",
|
||
"resolve",
|
||
"repeat_escalation",
|
||
"declare_incident",
|
||
"notify_whole_channel",
|
||
"notify_if_time_from_to",
|
||
"notify_if_num_alerts_in_window",
|
||
], s.type)
|
||
])
|
||
error_message = "Недопустимый тип шага эскалации. Проверь список допустимых значений в описании переменной."
|
||
}
|
||
}
|