locals {

  # Определяем HTTP заголовки на основе значения disable_provenance
  grafana_headers = {
    "X-Disable-Provenance" = var.disable_provenance ? "true" : "false"
  }

  # Contact points configuration
  contact_points = [
    {
      name       = "default"
      type       = "slack"
      is_default = true
      settings = {
        webhook_url = data.vault_kv_secret_v2.secret_ext.data["mmwebhook_default"]
        template    = "../../modules/grafana_contact_points/template/alerts_message_mm.template"
      }
    },

    {
      name       = "infra-alerts-critical"
      type       = "slack"
      is_default = false
      settings = {
        webhook_url = data.vault_kv_secret_v2.secret_ext.data["mmwebhook_infra_alerts_critical"]
        template    = "../../modules/grafana_contact_points/template/alerts_message_mm.template"
      }
    },

    {
      name       = "infra-alerts-informational"
      type       = "slack"
      is_default = false
      settings = {
        webhook_url = data.vault_kv_secret_v2.secret_ext.data["mmwebhook_infra_alerts_info"]
        template    = "../../modules/grafana_contact_points/template/alerts_message_mm.template"
      }
    },

    {
      name       = "infra-alerts-test"
      type       = "slack"
      is_default = false
      settings = {
        webhook_url = data.vault_kv_secret_v2.secret_ext.data["mmwebhook_infra_alerts_test"]
        template    = "../../modules/grafana_contact_points/template/alerts_message_mm.template"
      }
    }
  ]
}
