variable "target_account_id" {
  description = "Alibaba Cloud account in which this environment is allowed to run."
  type        = string
  default     = "5083883504403318"
}

variable "target_account_name" {
  type    = string
  default = "data-integration-team-internal-alicloud"
}

variable "alicloud_profile" {
  type    = string
  default = "5083883504403318-poweruser"
}

variable "alicloud_region" {
  type    = string
  default = "ap-southeast-1"
}

variable "name_prefix" {
  type    = string
  default = "date-integration-test"

  validation {
    condition     = can(regex("^[a-z][a-z0-9-]{2,23}$", var.name_prefix))
    error_message = "name_prefix must contain 3-24 lowercase letters, digits, or hyphens."
  }
}

variable "vpc_cidr" {
  type    = string
  default = "10.91.0.0/20"
}

variable "instance_type" {
  description = "2-vCPU/4-GiB ECS type."
  type        = string
  default     = "ecs.c9i.large"
}

variable "image_name_regex" {
  description = "Ubuntu 22.04 x86_64 system image used by the shared bootstrap."
  type        = string
  default     = "^ubuntu_22_04_x64_20G_alibase_.*"
}

variable "root_disk_size_gib" {
  type    = number
  default = 30
}

variable "data_disk_size_gib" {
  type    = number
  default = 50
}

variable "desired_state" {
  type    = string
  default = "running"

  validation {
    condition     = contains(["running", "stopped"], var.desired_state)
    error_message = "desired_state must be running or stopped."
  }
}

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

variable "port_base" {
  type     = number
  default  = null
  nullable = true

  validation {
    condition     = var.port_base == null ? true : var.port_base >= 20000 && var.port_base <= 60000 && floor(var.port_base) == var.port_base
    error_message = "port_base must be a whole number between 20000 and 60000."
  }
}

variable "privatelink_allowed_account_ids" {
  description = "Alibaba Cloud accounts allowed to create endpoints to the test service."
  type        = set(string)
  default = [
    "5083883504403318", # data-integration-team-internal-alicloud
    "5753857577068077", # staging dataplane
    "5841052134823325", # dbaas dev
  ]
}

variable "kafka_privatelink_root_domain_name" {
  type    = string
  default = "date-integration.alicloud.kafka.test"
}

variable "e2e_project_ids" {
  description = "Comma-separated TiDB Cloud E2E project IDs associated with AliCloud PrivateLink Kafka dependencies."
  type        = string
  default     = "1369847559694040763,1369847559694040575"
}

variable "mysql_user" {
  type    = string
  default = "e2e_admin"
}

variable "mysql_root_password" {
  type      = string
  default   = null
  nullable  = true
  sensitive = true
}

variable "mysql_password" {
  type      = string
  default   = null
  nullable  = true
  sensitive = true
}

variable "kafka_sasl_username" {
  type      = string
  default   = null
  nullable  = true
  sensitive = true
}

variable "kafka_sasl_password" {
  type      = string
  default   = null
  nullable  = true
  sensitive = true
}

variable "pulsar_token_secret" {
  type      = string
  default   = null
  nullable  = true
  sensitive = true
}

variable "enable_pulsar" {
  type    = bool
  default = true
}

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

variable "schema_registry_username" {
  type      = string
  default   = null
  nullable  = true
  sensitive = true
}

variable "schema_registry_password" {
  type      = string
  default   = null
  nullable  = true
  sensitive = true
}

variable "oss_bucket_name" {
  type     = string
  default  = null
  nullable = true
}
