190 lines
5 KiB
HCL
190 lines
5 KiB
HCL
# --- Proxmox Configuration ---
|
|
variable "proxmox_api_url" {
|
|
description = "Proxmox VE API URL"
|
|
type = string
|
|
}
|
|
|
|
variable "proxmox_api_token" {
|
|
description = "Proxmox VE API token"
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
variable "proxmox_node" {
|
|
description = "Default Proxmox node name (can be overridden per node)"
|
|
type = string
|
|
}
|
|
|
|
variable "proxmox_pool" {
|
|
description = "Proxmox resource pool"
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
# --- Cluster Configuration ---
|
|
variable "cluster_name" {
|
|
description = "The name of the Talos cluster."
|
|
type = string
|
|
default = "proxmox-talos-cluster"
|
|
}
|
|
|
|
variable "cluster_domain" {
|
|
description = "The domain name of the Talos cluster."
|
|
type = string
|
|
default = "cluster.local"
|
|
}
|
|
|
|
variable "talos_version" {
|
|
description = "The version of Talos Linux to use."
|
|
type = string
|
|
}
|
|
|
|
variable "talos_factory_schematic_id" {
|
|
description = "Talos Factory schematic ID used for installer image URLs."
|
|
type = string
|
|
}
|
|
|
|
variable "cni_name" {
|
|
description = "The name of the CNI to configure (e.g., 'flannel', 'cilium')."
|
|
type = string
|
|
default = "flannel"
|
|
}
|
|
|
|
# --- Global Network Configuration ---
|
|
variable "dns_servers" {
|
|
description = "Global DNS servers for the cluster"
|
|
type = list(string)
|
|
default = ["1.1.1.1", "1.0.0.1"]
|
|
}
|
|
|
|
variable "control_plane_vip" {
|
|
description = "Virtual IP for HA control plane (only used when multiple control plane nodes)"
|
|
type = string
|
|
}
|
|
|
|
variable "cluster_pod_nets" {
|
|
description = "The CIDR blocks for Kubernetes pods."
|
|
type = list(string)
|
|
default = ["10.244.0.0/16"]
|
|
}
|
|
|
|
variable "cluster_svc_nets" {
|
|
description = "The CIDR blocks for Kubernetes services."
|
|
type = list(string)
|
|
default = ["10.96.0.0/12"]
|
|
}
|
|
|
|
# --- Storage Configuration ---
|
|
variable "disk_storage" {
|
|
description = "Proxmox storage for primary disk"
|
|
type = string
|
|
}
|
|
|
|
variable "additional_disk_storage" {
|
|
description = "Proxmox storage for additional disks"
|
|
type = string
|
|
}
|
|
|
|
variable "talos_iso_file" {
|
|
description = "Talos ISO file in Proxmox storage"
|
|
type = string
|
|
}
|
|
|
|
variable "talos_image_update_mode" {
|
|
description = "How the Talos image should be staged on Proxmox nodes."
|
|
type = string
|
|
default = "manual"
|
|
|
|
validation {
|
|
condition = contains(["manual", "download"], var.talos_image_update_mode)
|
|
error_message = "talos_image_update_mode must be either 'manual' or 'download'."
|
|
}
|
|
}
|
|
|
|
variable "talos_image_storage" {
|
|
description = "Proxmox storage target for downloaded Talos ISO images."
|
|
type = string
|
|
default = "local"
|
|
}
|
|
|
|
variable "talos_image_architecture" {
|
|
description = "Talos image architecture used for factory downloads."
|
|
type = string
|
|
default = "amd64"
|
|
}
|
|
|
|
# --- Node Configuration ---
|
|
variable "nodes" {
|
|
description = "List of cluster nodes, each with its own network configurations."
|
|
type = list(object({
|
|
name = string
|
|
vmid = number
|
|
role = string # "controlplane" or "worker"
|
|
cores = number
|
|
memory = number
|
|
disk_size = string
|
|
tags = optional(list(string))
|
|
additional_disk_size = optional(string)
|
|
proxmox_node = optional(string)
|
|
|
|
# Define one or more networks per node.
|
|
# The first network in the list is considered the primary for IP and gateway settings.
|
|
networks = list(object({
|
|
mac_address = string
|
|
cidr = string
|
|
vlan_id = number
|
|
ip = optional(string) # Static IP, required for control plane, optional for workers
|
|
gateway = optional(string) # Should only be defined on the primary interface
|
|
}))
|
|
}))
|
|
|
|
validation {
|
|
condition = alltrue([for node in var.nodes : length(node.networks) >= 1])
|
|
error_message = "Each node must have at least one network defined."
|
|
}
|
|
|
|
validation {
|
|
condition = alltrue([for node in var.nodes : node.role == "controlplane" ? node.networks[0].ip != null : true])
|
|
error_message = "The first network for a 'controlplane' node must have a static IP address."
|
|
}
|
|
}
|
|
|
|
variable "default_physical_interface" {
|
|
description = "Default physical interface for nodes (fallback)"
|
|
type = string
|
|
default = "enp6s0"
|
|
}
|
|
|
|
variable "node_interfaces" {
|
|
description = "Map of Proxmox node names to their physical interfaces"
|
|
type = map(string)
|
|
default = {}
|
|
|
|
# Example:
|
|
# {
|
|
# "pve1" = "enp1s0"
|
|
# "pve2" = "ens18"
|
|
# "pve3" = "enp6s0"
|
|
# }
|
|
}
|
|
|
|
variable "create_vlan_interface" {
|
|
description = "Whether to create VLAN interfaces (true for tagged VLANs, false for untagged)"
|
|
type = bool
|
|
default = true
|
|
}
|
|
|
|
# --- Registry Proxy Configuration ---
|
|
variable "image_cache_proxy" {
|
|
description = "Configuration for the TrueNAS container image registry proxy/mirror."
|
|
type = object({
|
|
enabled = bool
|
|
ip = string
|
|
port = number
|
|
})
|
|
default = {
|
|
enabled = false
|
|
ip = ""
|
|
port = 3128
|
|
}
|
|
} |