variable "groups" { description = "List of alert groups with their definitions and data sources" type = list(object({ dashboard_alert_group_name = string alert_definitions_path = optional(string, null) dashboard_path_if_exist = optional(string, null) keep_manual_changes = optional(bool, false) prevent_destroy_on_recreate = optional(bool, false) alerts_on_datasources_uid = list(string) })) } variable "datasources" { description = "List of Grafana data sources" type = list(object({ # Main parameters name = string # Data source name (displayed in Grafana) uid = string # Unique source identifier type = string # Data source type (e.g., prometheus, mysql, clickhouse) url = optional(string, null) # Connection URL (for most sources) username = optional(string, null) access_mode = string # Access mode: proxy or direct is_default = bool # Set as default source # Authentication settings basic_auth = optional(bool, false) # Use basic authentication basic_auth_user = optional(string, null) # Username for basic authentication basic_auth_password = optional(string, null) # Password for basic authentication # Additional parameters json_data = optional(map(any), {}) # Additional parameters in JSON format secure_json_data = optional(map(string), {}) # Sensitive data in JSON format # Terraform lifecycle management fields keep_manual_changes = optional(bool, false) # Ignore manual changes in Grafana prevent_destroy_on_recreate = optional(bool, false) # Prevent resource deletion on update })) } variable "org_id" { description = "ID of the Grafana organization" type = string } variable "folder_uids" { description = "Mapping of alert group names to their folder UIDs" type = map(string) } variable "folder_time_ranges" { description = <<-EOT Mapping of folder UIDs to their default time ranges in seconds. If not specified for a folder, alerts will use the folder's default of 60 seconds (1 minute). Example: { "folder1_uid" = 300 # 5 minutes "folder2_uid" = 3600 # 1 hour } EOT type = map(number) default = {} } # Alert duration and timing configuration variable "interval_seconds" { description = "Interval in seconds for evaluating alerts" type = number default = 60 } variable "default_interval_ms" { description = "Default interval in milliseconds for evaluating alert expressions" type = number default = 60000 } variable "default_max_data_points" { description = "Default maximum number of data points" type = number default = 43200 } variable "default_no_data_state" { description = "Default no data state for alerts" type = string default = "OK" } variable "default_exec_err_state" { description = "Default execution error state for alerts" type = string default = "Error" } variable "default_alert_duration" { description = "Default duration (in seconds) for how long a condition must be true before alerting" type = number default = 300 # 5 minutes } variable "default_evaluation_interval" { description = "Default interval (in seconds) between alert rule evaluations" type = number default = 60 # 1 minute } variable "default_time_range_from" { description = "Default time range (in seconds) for main query lookback" type = number default = 604800 # 7 days } variable "default_processing_range" { description = "Default time range (in seconds) for processing blocks" type = number default = 600 # 10 minutes } variable "disable_provenance" { description = "Controls whether Grafana provisioning is disabled" type = bool default = true }