variable "subscription_id" {
  type        = string
  description = "Azure subscription id the cluster lives in."
}

variable "tenant_id" {
  type        = string
  description = "Azure tenant id. Leave empty to use the tenant from your active `az login`."
  default     = ""
}

variable "location" {
  type        = string
  description = "Azure region. Mirrors the `region` knob in cluster-aws / cluster-gcp."
  default     = "eastus"
}

variable "environment" {
  type        = string
  description = "Environment name (staging, prod, etc.). Goes into resource tags + names."
  default     = "staging"
}

variable "project" {
  type        = string
  description = "Project tag (analog of AWS `Project`)."
  default     = "aries-datalake"
}

variable "cluster_name" {
  type        = string
  description = "AKS cluster name. Defaults to `${var.project}-${var.environment}`."
  default     = ""
}

variable "resource_group_name" {
  type        = string
  description = "Resource group name. Defaults to `<cluster_name>-rg`. Always created by this module."
  default     = ""
}

variable "k8s_version" {
  type        = string
  description = "Kubernetes version. Leave empty to pull the AKS default for the region."
  default     = ""
}

variable "vnet_cidr" {
  type        = string
  description = "VNet CIDR block. Must not overlap compute-aws (10.42), cluster-aws (10.43), cluster-gcp (10.44) if you ever peer them."
  default     = "10.45.0.0/16"
}

variable "node_subnet_cidr" {
  type        = string
  description = "Subnet CIDR within the VNet that hosts AKS nodes."
  default     = "10.45.0.0/22"
}

variable "pod_cidr" {
  type        = string
  description = "Overlay CIDR for pod IPs (CNI Overlay mode). Doesn't need to live inside the VNet."
  default     = "10.244.0.0/16"
}

variable "service_cidr" {
  type        = string
  description = "Kubernetes Services CIDR."
  default     = "10.0.0.0/16"
}

variable "dns_service_ip" {
  type        = string
  description = "kube-dns IP — must be inside service_cidr."
  default     = "10.0.0.10"
}

variable "node_vm_size" {
  type        = string
  description = "VM SKU for the default node pool. Standard_D2s_v5 ≈ t3.medium ≈ e2-standard-2."
  default     = "Standard_D2s_v5"
}

variable "node_count" {
  type        = number
  description = "Starting node count for the default user pool."
  default     = 2
}

variable "node_min_count" {
  type        = number
  description = "Autoscaler floor for the default user pool."
  default     = 1
}

variable "node_max_count" {
  type        = number
  description = "Autoscaler ceiling for the default user pool."
  default     = 4
}

variable "system_node_vm_size" {
  type        = string
  description = "VM SKU for the system node pool (kube-system workloads)."
  default     = "Standard_D2s_v5"
}

variable "tfstate_passphrase" {
  type        = string
  description = "Passphrase for OpenTofu state encryption. See encryption.tofu.example."
  default     = ""
  sensitive   = true
}

locals {
  cluster_name        = length(var.cluster_name) > 0 ? var.cluster_name : "${var.project}-${var.environment}"
  resource_group_name = length(var.resource_group_name) > 0 ? var.resource_group_name : "${local.cluster_name}-rg"
  name_prefix         = "${var.project}-${var.environment}-cluster"

  common_tags = {
    project     = var.project
    environment = var.environment
    component   = "cluster"
    managed-by  = "opentofu"
  }
}
