variable "env" {
  type = string
}

variable "aws_region" {
  type = string
}

variable "logical_region_name" {
  type = string

  validation {
    condition     = length("${var.env}-seed-${var.logical_region_name}-cluster-") <= 38
    error_message = "The derived EKS IAM role name prefix must not exceed 38 characters."
  }
}

variable "enable_falco" {
  type        = bool
  default     = true
  description = "Deploy Falco to the regional control-plane EKS cluster."
}

variable "service_plan" {
  type    = string
  default = "Premium"

  validation {
    condition     = contains(["Premium", "EssentialV2"], var.service_plan)
    error_message = "service_plan must be Premium or EssentialV2."
  }
}

variable "availability_zones" {
  type = list(string)
}

variable "dataplane_accounts" {
  type = list(string)
  validation {
    condition     = length(var.dataplane_accounts) > 0
    error_message = "At least one dataplane account is required."
  }
}

variable "vpc" {
  type = object({
    cidr = optional(string, "10.1.0.0/16")
  })
  default = {}
}

variable "eks" {
  type = object({
    k8s_version = optional(string, "1.36")
    node_groups = optional(map(object({
      name                           = string
      ami_type                       = optional(string, "BOTTLEROCKET_x86_64")
      use_name_prefix                = optional(bool, false)
      use_latest_ami_release_version = optional(bool, false)
      instance_types                 = optional(list(string), ["m6i.large"])
      desired_size                   = optional(number, 3)
      min_size                       = optional(number, 1)
      max_size                       = optional(number, 10)
      max_pods_per_node              = optional(number, 100)
      additional_tags                = optional(map(string), {})
      })), {
      worker = {
        name = "worker"
      }
    })
  })
  default = {}
}
