# General variables
variable "environment" {
  description = "Name of the environment, e.g. dev, qa, prod"
}

variable "service_name" {
  description = "Service name, without environment prefix"
}

variable "application_family" {
  description = "Application family to which this service belongs"
  type        = string
}

variable "teams" {
  type        = set(string)
  description = "A set of Datadog Teams to associate the resources with"
  default     = []
}

variable "notification_endpoints" {
  description = "Endpoints for alerts. Can be email, slack, pagerduty, etc"
}

variable "escalation_notification_endpoints" {
  description = "Endpoints for escalation alerts. Can be email, slack, pagerduty, etc"
}

variable "alert_notification_endpoints" {
  type        = string
  description = "Additional endpoints to send only alert notifications to. Can be email, slack, pagerduty, etc."
  default     = ""
}

variable "no_data_notification_endpoints" {
  type        = string
  description = "Additional endpoints to send only no data notifications to. Can be email, slack, pagerduty, etc."
  default     = ""
}

# Offline agents monitor
variable "offline_agent_monitor_enabled" {
  description = "Enable monitoring of offline Jenkins agents"
  default     = true
}

locals {
  # Only team tags are supported for dashboards
  tags = flatten([
    "application_family:${var.application_family}",
    "env:${var.environment}",
    "environment:${var.environment}",
    "service:${var.service_name}",
    "service_name:${var.service_name}",
    [for team in var.teams : "team:${team}"],
  ])
}
