variable "cache" {
  description = "List of Cache instance configurations"
  type = list(object({
    name                 = string
    serverless_cache     = bool
    engine               = string
    family               = string
    engine_version       = string
    major_engine_version = string
    port                 = number

    node_type                   = string
    num_cache_clusters          = number
    at_rest_encryption_enabled  = bool
    log_group_retention_in_days = number
    apply_immediately           = bool

    data_storage_minimum = optional(number, null)
    data_storage_maximum = optional(number, null)

    ecpu_per_second_minimum  = optional(number, null)
    ecpu_per_second_maximum  = optional(number, null)
    snapshot_retention_limit = number
    snapshot_window          = string
    maintenance_window       = string
    subnet_ids               = list(string)
    security_group_ids       = list(string)
    notification_topic_arn   = string
  }))
  default = [
    {
      name             = "redis"
      serverless_cache = false

      engine               = "redis"
      family               = "redis7"
      engine_version       = "7.1"
      major_engine_version = "7"
      port                 = 6379

      node_type                   = "cache.t4g.micro"
      num_cache_clusters          = 1
      snapshot_retention_limit    = 1
      at_rest_encryption_enabled  = true
      log_group_retention_in_days = 365
      apply_immediately           = true

      snapshot_window    = "00:00"
      maintenance_window = "Mon:01:00-Mon:02:00"

      subnet_ids             = []
      security_group_ids     = []
      notification_topic_arn = ""
    }
  ]
}

variable "service_tags" {
  description = "Resource tags"
  type        = map(string)
  default     = {}
}
