chore(terraform): terraform format

This commit is contained in:
2025-12-25 22:14:46 +01:00
parent 3c048f3c3d
commit 178f731f38
2 changed files with 9 additions and 9 deletions

View File

@@ -2,27 +2,27 @@ locals {
# Get current DHCP IPs from QEMU guest agent (from VM resource computed attribute)
# Find first non-loopback, non-empty IP address from any interface
controlplane_dhcp_ips = [
for vm in proxmox_virtual_environment_vm.controlplane :
for vm in proxmox_virtual_environment_vm.controlplane :
flatten([
for iface_ips in vm.ipv4_addresses :
for iface_ips in vm.ipv4_addresses :
[for ip in iface_ips : ip if ip != "127.0.0.1"]
])[0]
]
worker_dhcp_ips = [
for vm in proxmox_virtual_environment_vm.worker :
for vm in proxmox_virtual_environment_vm.worker :
flatten([
for iface_ips in vm.ipv4_addresses :
for iface_ips in vm.ipv4_addresses :
[for ip in iface_ips : ip if ip != "127.0.0.1"]
])[0]
]
# Use DHCP IPs for initial connection and configuration apply
# Note: If static IPs are configured via var.controlplane_ips/var.worker_ips,
# Talos will reconfigure the network after initial apply, but we connect via DHCP
controlplane_ips = local.controlplane_dhcp_ips
worker_ips = local.worker_dhcp_ips
# For client config and bootstrap, use static IPs if configured, otherwise DHCP
controlplane_endpoints = length(var.controlplane_ips) > 0 ? var.controlplane_ips : local.controlplane_dhcp_ips

View File

@@ -173,7 +173,7 @@ resource "talos_machine_configuration_apply" "controlplane" {
config_patches = concat(
[
templatefile("${path.module}/templates/install-disk-and-hostname.yaml.tmpl", {
hostname = "${var.cluster_name}-cp-${count.index + 1}"
hostname = "${var.cluster_name}-cp-${count.index + 1}"
}),
templatefile("${path.module}/templates/proxmox-ccm.yaml.tmpl", {
proxmox_url = var.proxmox_endpoint
@@ -213,7 +213,7 @@ resource "talos_machine_configuration_apply" "worker" {
config_patches = concat(
[
templatefile("${path.module}/templates/install-disk-and-hostname.yaml.tmpl", {
hostname = "${var.cluster_name}-worker-${count.index + 1}"
hostname = "${var.cluster_name}-worker-${count.index + 1}"
}),
templatefile("${path.module}/templates/proxmox-ccm.yaml.tmpl", {
proxmox_url = var.proxmox_endpoint