diff --git a/proxmox/locals.tf b/proxmox/locals.tf index 3d37243..a8db9e3 100644 --- a/proxmox/locals.tf +++ b/proxmox/locals.tf @@ -2,4 +2,5 @@ locals { hv01_id = [ for node in data.proxmox_virtual_environment_node.hvc01 : node if node.node_name == "hv01"][0].id # Validate talos_version variable talos_version = [ for version in data.talos_image_factory_versions.this.talos_versions : version if version == var.talos_version][0] + cluster_endpoint = "https://${var.cluster_name}:6443" } \ No newline at end of file diff --git a/proxmox/outputs.tf b/proxmox/outputs.tf index ab4afc8..d4e1840 100644 --- a/proxmox/outputs.tf +++ b/proxmox/outputs.tf @@ -11,5 +11,6 @@ output "talos_schematic_id" { output "debug" { description = "For debugging resource or data key values" - value = data.talos_image_factory_urls.this.urls + value = data.talos_machine_configuration.this["cp01"] + sensitive = false } \ No newline at end of file diff --git a/proxmox/plan.tfplan b/proxmox/plan.tfplan deleted file mode 100644 index 91912a4..0000000 Binary files a/proxmox/plan.tfplan and /dev/null differ diff --git a/proxmox/talos.auto.tfvars b/proxmox/talos.auto.tfvars index d4c13f7..150e73c 100644 --- a/proxmox/talos.auto.tfvars +++ b/proxmox/talos.auto.tfvars @@ -1,2 +1,3 @@ talos_version = "v1.13.9" -cluster_endpoint = "https://k8s01.balsillie.house:6443" \ No newline at end of file +cluster_name = "k8s01.balsillie.house" +kubernetes_version = "1.36.3" \ No newline at end of file diff --git a/proxmox/talos.tf b/proxmox/talos.tf index 0f3d5c8..c6d67dd 100644 --- a/proxmox/talos.tf +++ b/proxmox/talos.tf @@ -16,4 +16,17 @@ data "talos_image_factory_urls" "this" { talos_version = local.talos_version schematic_id = talos_image_factory_schematic.this.id platform = "nocloud" +} + +data "talos_machine_configuration" "this" { + for_each = { for guest in var.vm_guests: guest.name => guest if contains(["controlplane", "worker"], guest.role) } + cluster_endpoint = local.cluster_endpoint + cluster_name = var.cluster_name + config_patches = [] + docs = false + examples = false + kubernetes_version = var.kubernetes_version + machine_secrets = talos_machine_secrets.this.machine_secrets + machine_type = each.value.role + talos_version = local.talos_version } \ No newline at end of file diff --git a/proxmox/variables.tf b/proxmox/variables.tf index b3992dc..990dd85 100644 --- a/proxmox/variables.tf +++ b/proxmox/variables.tf @@ -13,6 +13,10 @@ variable "talos_version" { type = string } -variable "cluster_endpoint" { +variable "cluster_name" { + type = string +} + +variable "kubernetes_version" { type = string } \ No newline at end of file diff --git a/proxmox/vms.auto.tfvars b/proxmox/vms.auto.tfvars index 0d1c0be..791e8ad 100644 --- a/proxmox/vms.auto.tfvars +++ b/proxmox/vms.auto.tfvars @@ -4,7 +4,39 @@ vm_guests = [ host = "hv01" ipv4_address = "10.96.10.61" memory = 4096 - name = "k8s01-cp01" - role = "talos_control_plane" + name = "cp01" + role = "controlplane" + }, + { + cpu = 1 + host = "hv02" + ipv4_address = "10.96.10.62" + memory = 4096 + name = "cp02" + role = "controlplane" + }, + { + cpu = 1 + host = "hv03" + ipv4_address = "10.96.10.63" + memory = 4096 + name = "cp03" + role = "controlplane" + }, + { + cpu = 1 + host = "hv02" + ipv4_address = "10.96.10.64" + memory = 4096 + name = "wn01" + role = "worker" + }, + { + cpu = 1 + host = "hv03" + ipv4_address = "10.96.10.65" + memory = 4096 + name = "wn02" + role = "worker" } ] \ No newline at end of file