env = "dev"

# Maximum dashboard UID length after auto-generation from json uid + file path
dashboard_uid_max_length = 40

# Controls the ability to manually edit resources in Grafana.
#
# disable_provenance = true:
#   - Removes provisioning tags and locks for alerting components.
#   - Allows manual changes through the Grafana UI for the following resources:
#     - Alert Rules
#     - Contact Points
#     - Mute Timings
#     - Notification Templates
#     - Notification Policies
#
# disable_provenance = false:
#   - Preserves provisioning tags and locks for the above components.
#   - Prevents manual changes in the Grafana UI from conflicting with Terraform-managed alerting resources.
#   - This setting ensures that any changes made directly in the Grafana UI will not persist for these resources.

disable_provenance    = true
enable_contact_points = true

# Grafana organization settings as an array of objects
organizations = [
  {
    create_new_organization     = false
    organization_name           = "adibrov"
    keep_manual_changes         = true
    prevent_destroy_on_recreate = true
  }
]


# Current organization for deploying
org_id = "3"

# Alert groups configuration
groups = [
  {
    dashboard_alert_group_name  = "System Alerts"
    folder_uid                  = "system"
    alert_definitions_path      = "alerts/system"
    dashboard_path_if_exist     = "dashboards/system"
    keep_manual_changes         = false
    prevent_destroy_on_recreate = false
    alerts_on_datasources_uid   = ["prometheus"]
  },
  {
    dashboard_alert_group_name  = "Self monitoring"
    folder_uid                  = "self-monitoring"
    alert_definitions_path      = "alerts/self-monitoring"
    dashboard_path_if_exist     = "dashboards/self-monitoring"
    keep_manual_changes         = false
    prevent_destroy_on_recreate = false
    alerts_on_datasources_uid   = ["prometheus-local-1"]
  }
]
# Data sources configuration
datasources = [
  {
    name        = "prometheus"
    uid         = "prometheus"
    type        = "prometheus"
    url         = "http://192.168.0.105:9090"
    access_mode = "proxy"
    is_default  = true
    basic_auth  = false
    json_data = {
      timeInterval = "15s"
    }
    keep_manual_changes         = false
    prevent_destroy_on_recreate = false
  }
]

# Notification policies configuration
notification_policies = [
  {
    contact_point = "infra-alerts-critical"
    continue      = true
    matchers = [
      {
        label = "severity"
        match = "="
        value = "disaster"
      },
      {
        label = "team"
        match = "="
        value = "infra"
      }
    ]
  },
  {
    contact_point = "infra-alerts-critical"
    continue      = true
    matchers = [
      {
        label = "severity"
        match = "="
        value = "critical"
      },
      {
        label = "team"
        match = "="
        value = "infra"
      }
    ]
  },
  {
    contact_point = "infra-alerts-informational"
    continue      = true
    matchers = [
      {
        label = "severity"
        match = "="
        value = "warning"
      },
      {
        label = "team"
        match = "="
        value = "infra"
      }
    ]
  },
  {
    contact_point = "infra-alerts-informational"
    continue      = true
    matchers = [
      {
        label = "severity"
        match = "="
        value = "perfomance"
      },
      {
        label = "team"
        match = "="
        value = "infra"
      }
    ]
  },
  {
    contact_point = "infra-alerts-test"
    continue      = true
    matchers = [
      {
        label = "status"
        match = "="
        value = "test"
      }
    ]
  }
]

# ── Grafana IRM ──────────────────────────────────────────────────────────────
# Цепочки эскалации описаны в locals.tf, ID пользователей — в Vault
# (app/groups/monitoring/grafana/dev/ext → irm_user_adibrov)

enable_irm = true
