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

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

variable "cluster_name" {
  description = "Cluster name, eg ny_internal, avl_dmz_external etc"
  default     = ""
}

# AWS variables
variable "aws_region" {
  description = "AWS region from which to pull metrics"
  default     = "us-east-1"
}

variable "healthy_haproxy_master_tasks_monitor_enabled" {
  description = "Whether or not healthy tasks monitor is enabled"
  default     = true
}

variable "healthy_haproxy_master_tasks_critical_number" {
  description = "Number of healthy_tasks for critical alerts"
  default     = 1
}

variable "healthy_haproxy_master_tasks_critical_recovery_number" {
  description = "Number of healthy_tasks for critical recovery"
  default     = 1.1
}

variable "healthy_haproxy_master_tasks_warning_number" {
  description = "Number of healthy_tasks for warnings"
  default     = 1.5
}

variable "healthy_haproxy_master_tasks_warning_recovery_number" {
  description = "Number of healthy_tasks for warning recovery"
  default     = 2
}

variable "healthy_haproxy_master_tasks_ok_number" {
  description = "Number of healthy_tasks that are ok"
  default     = 2
}

variable "healthy_haproxy_master_tasks_notifications" {
  description = "where to send notifications"
  default     = "@slack-orcd-monitoring"
}

variable "healthy_keepalived_tasks_monitor_enabled" {
  description = "Whether or not healthy tasks monitor is enabled"
  default     = true
}

variable "healthy_keepalived_tasks_critical_number" {
  description = "Number of healthy_tasks for critical alerts"
  default     = 2
}

variable "healthy_keepalived_tasks_critical_recovery_number" {
  description = "Number of healthy_tasks for critical recovery"
  default     = 4
}

variable "healthy_keepalived_tasks_warning_number" {
  description = "Number of healthy_tasks for warnings"
  default     = 4
}

variable "healthy_keepalived_tasks_warning_recovery_number" {
  description = "Number of healthy_tasks for warning recovery"
  default     = 5
}

variable "healthy_keepalived_tasks_ok_number" {
  description = "Number of healthy_tasks that are ok"
  default     = 6
}

variable "healthy_keepalived_tasks_notifications" {
  description = "where to send notifications"
  default     = "@slack-orcd-monitoring"
}

locals {
  # Only team tags are supported for dashboards
  dashboard_tags = [for team in var.teams : "team:${team}"]

  tags = flatten([
    "environment:${var.environment}",
    "haproxy_cluster:${var.cluster_name}",
    [for team in var.teams : "team:${team}"],
  ])
}
