variable "env" {
  type = string
}

variable "aws_region" {
  type = string
}

variable "logical_region_name" {
  type = string
}

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

variable "clinic_endpoint_service_name" {
  description = "The vpc endpoint service name for clinic"
  type        = string
}

# These IAM roles must be pre-created in the customer (dataplane) account before
# apply. They are NOT created by this Terraform module. The customer must run the
# iam_roles/ scripts from https://github.com/tidbcloud/byoc-account-setup to
# provision them. The default values match the role names created by those scripts.
variable "cluster_role_name" {
  description = "o11y cluster role name"
  type        = string
  default     = "tidbcloud-o11y-eks-cluster-role"
}

variable "node_role_name" {
  description = "o11y node role name"
  type        = string
  default     = "tidbcloud-o11y-eks-node-role"
}

variable "vpc" {
  type = object({
    cidr = optional(string, "10.1.0.0/16")
    # Enable Interface VPC endpoints for ECR so that image pulls stay within the
    # AWS network. Without this, ECR traffic traverses the public internet and the
    # customer incurs significant AWS data-transfer egress charges. Recommended for
    # all production deployments.
    enable_ecr_privatelink = optional(bool, false)
  })
  default = {}
}

variable "eks" {
  type = object({
    k8s_version = optional(string, "1.36")
    node_groups = optional(map(object({
      name                           = string
      instance_types                 = optional(list(string))
      ami_type                       = optional(string, "BOTTLEROCKET_x86_64")
      use_name_prefix                = optional(bool, true)
      use_latest_ami_release_version = optional(bool, false)
      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), {})
      labels                         = optional(map(string), {})
      })), {
      worker = {
        name = "worker"

        labels = {
          node_type = "worker"
        }
      }
    })
    node_group_az = optional(string)
  })
  default = {}
}

variable "sns_topic_arn" {
  description = "The ARN of the SNS topic for o11y"
  type        = string
}

variable "o11y_account_id" {
  description = "The AWS account ID for o11y global resources"
  type        = string
}

variable "byoc_tenant_id" {
  type = string
}

variable "byoc_ecr" {
  type = string
}

variable "seed_account" {
  type = string
}

variable "o11y_hosted_zone_name" {
  type = string
}

variable "o11y_hosted_zone_id" {
  type = string
}

# Image tag for the O11Y regional server (module.o11y-regional-server).
# This is NOT the TiDB Cloud control-plane regional server in module.seed.
# The tag is pinned — check this value before upgrading the regional server image.
variable "regional_server_img_tag" {
  type    = string
  default = "2026-09-08-f4074e2efd083d599aa2836878bfff43416a3a16"
}

variable "tags" {
  description = "Customer-defined tags to apply to shoot resources"
  type        = map(string)
  default     = {}
}

variable "destroy_mode" {
  type    = bool
  default = false
}
