mirror of
https://github.com/optim-enterprises-bv/homelab.git
synced 2025-10-30 01:22:31 +00:00
chore(tofu): don't use variables for nodes and volumes in main module
This commit is contained in:
@@ -6,14 +6,62 @@ module "talos" {
|
||||
}
|
||||
|
||||
talos_image = {
|
||||
version = "v1.7.5"
|
||||
version = "v1.7.5"
|
||||
schematic = file("${path.module}/config/talos-image-schematic.yaml")
|
||||
}
|
||||
cluster_config = var.cluster_config
|
||||
|
||||
cilium = {
|
||||
values = file("${path.module}/../../k8s/infra/network/cilium/values.yaml")
|
||||
install = file("${path.module}/bootstrap/cilium/install.yaml")
|
||||
}
|
||||
|
||||
cluster_config = {
|
||||
cluster_name = "talos"
|
||||
proxmox_cluster = "homelab"
|
||||
endpoint = "https://192.168.1.100:6443"
|
||||
talos_version = "v1.7"
|
||||
nodes = {
|
||||
"ctrl-00" = {
|
||||
machine_type = "controlplane"
|
||||
ip = "192.168.1.100"
|
||||
mac_address = "BC:24:11:2E:C8:00"
|
||||
host_node = "abel"
|
||||
vm_id = 8000
|
||||
cpu = 8
|
||||
ram_dedicated = 20480
|
||||
igpu = true
|
||||
}
|
||||
"ctrl-01" = {
|
||||
host_node = "euclid"
|
||||
machine_type = "controlplane"
|
||||
ip = "192.168.1.101"
|
||||
mac_address = "BC:24:11:2E:C8:01"
|
||||
vm_id = 8001
|
||||
cpu = 4
|
||||
ram_dedicated = 20480
|
||||
igpu = true
|
||||
}
|
||||
"ctrl-02" = {
|
||||
host_node = "cantor"
|
||||
machine_type = "controlplane"
|
||||
ip = "192.168.1.102"
|
||||
mac_address = "BC:24:11:2E:C8:02"
|
||||
vm_id = 8002
|
||||
cpu = 4
|
||||
ram_dedicated = 4096
|
||||
}
|
||||
//"work-00" = {
|
||||
// host_node = "abel"
|
||||
// machine_type = "worker"
|
||||
// ip = "192.168.1.110"
|
||||
// mac_address = "BC:24:11:2E:08:00"
|
||||
// vm_id = 8100
|
||||
// cpu = 8
|
||||
// ram_dedicated = 4096
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module "proxmox_csi_plugin" {
|
||||
@@ -52,5 +100,34 @@ module "volumes" {
|
||||
kubernetes = kubernetes
|
||||
}
|
||||
proxmox_api = var.proxmox
|
||||
volumes = var.volumes
|
||||
volumes = {
|
||||
pv-sonarr-config = {
|
||||
node = "cantor"
|
||||
size = "4G"
|
||||
}
|
||||
pv-radarr-config = {
|
||||
node = "cantor"
|
||||
size = "4G"
|
||||
}
|
||||
pv-lidarr-config = {
|
||||
node = "cantor"
|
||||
size = "4G"
|
||||
}
|
||||
pv-prowlarr-config = {
|
||||
node = "euclid"
|
||||
size = "1G"
|
||||
}
|
||||
pv-torrent-config = {
|
||||
node = "euclid"
|
||||
size = "1G"
|
||||
}
|
||||
pv-jellyfin-config = {
|
||||
node = "abel"
|
||||
size = "12G"
|
||||
}
|
||||
pv-plex-config = {
|
||||
node = "abel"
|
||||
size = "12G"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,45 +10,45 @@ variable "proxmox" {
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "cluster_config" {
|
||||
description = "Talos node configuration"
|
||||
type = object({
|
||||
|
||||
cluster_name = string
|
||||
proxmox_cluster = string
|
||||
endpoint = string
|
||||
talos_version = string
|
||||
|
||||
nodes = map(
|
||||
object({
|
||||
host_node = string
|
||||
machine_type = string
|
||||
ip = string
|
||||
mac_address = string
|
||||
vm_id = number
|
||||
cpu = number
|
||||
ram_dedicated = number
|
||||
update = optional(bool, false)
|
||||
igpu = optional(bool, false)
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
validation {
|
||||
condition = length([
|
||||
for n in var.cluster_config.nodes : n if contains(["controlplane", "worker"], n.machine_type)]) == length(var.cluster_config.nodes)
|
||||
error_message = "Node machine_type must be either 'controlplane' or 'worker'."
|
||||
}
|
||||
}
|
||||
|
||||
variable "volumes" {
|
||||
type = map(
|
||||
object({
|
||||
node = string
|
||||
size = string
|
||||
storage = optional(string, "local-zfs")
|
||||
vmid = optional(number, 9999)
|
||||
format = optional(string, "raw")
|
||||
})
|
||||
)
|
||||
}
|
||||
#variable "cluster_config" {
|
||||
# description = "Talos node configuration"
|
||||
# type = object({
|
||||
#
|
||||
# cluster_name = string
|
||||
# proxmox_cluster = string
|
||||
# endpoint = string
|
||||
# talos_version = string
|
||||
#
|
||||
# nodes = map(
|
||||
# object({
|
||||
# host_node = string
|
||||
# machine_type = string
|
||||
# ip = string
|
||||
# mac_address = string
|
||||
# vm_id = number
|
||||
# cpu = number
|
||||
# ram_dedicated = number
|
||||
# update = optional(bool, false)
|
||||
# igpu = optional(bool, false)
|
||||
# })
|
||||
# )
|
||||
# })
|
||||
#
|
||||
# validation {
|
||||
# condition = length([
|
||||
# for n in var.cluster_config.nodes : n if contains(["controlplane", "worker"], n.machine_type)]) == length(var.cluster_config.nodes)
|
||||
# error_message = "Node machine_type must be either 'controlplane' or 'worker'."
|
||||
# }
|
||||
#}
|
||||
#
|
||||
#variable "volumes" {
|
||||
# type = map(
|
||||
# object({
|
||||
# node = string
|
||||
# size = string
|
||||
# storage = optional(string, "local-zfs")
|
||||
# vmid = optional(number, 9999)
|
||||
# format = optional(string, "raw")
|
||||
# })
|
||||
# )
|
||||
#}
|
||||
|
||||
Reference in New Issue
Block a user