variable "log_groups" {
  description = "Map of CloudWatch log groups to create"
  type = map(object({
    name              = string
    retention_in_days = optional(number, 90)
    kms_key_id        = optional(string, null)
    skip_destroy      = optional(bool, false)
  }))
  default = {}
}

variable "metric_filters" {
  description = "Map of metric filters on log groups"
  type = map(object({
    log_group_key    = string
    pattern          = string
    metric_name      = string
    metric_namespace = string
    metric_value     = optional(string, "1")
    default_value    = optional(string, "0")
  }))
  default = {}
}

variable "alarms" {
  description = "Map of CloudWatch metric alarms"
  type = map(object({
    alarm_name          = string
    alarm_description   = optional(string, "")
    namespace           = string
    metric_name         = string
    statistic           = optional(string, "Sum")
    period              = optional(number, 300)
    evaluation_periods  = optional(number, 1)
    threshold           = number
    comparison_operator = string
    treat_missing_data  = optional(string, "notBreaching")
    dimensions          = optional(map(string), {})
    alarm_actions       = optional(list(string), [])
    ok_actions          = optional(list(string), [])
    datapoints_to_alarm = optional(number, null)
  }))
  default = {}
}

variable "composite_alarms" {
  description = "Map of composite CloudWatch alarms"
  type = map(object({
    alarm_name        = string
    alarm_description = optional(string, "")
    alarm_rule        = string
    alarm_actions     = optional(list(string), [])
    ok_actions        = optional(list(string), [])
  }))
  default = {}
}

variable "dashboards" {
  description = "Map of CloudWatch dashboard name to JSON body"
  type        = map(string)
  default     = {}
}

variable "tags" {
  description = "Resource tags to apply to all resources"
  type        = map(string)
  default     = {}
}
