chore(terraform): terraform format
This commit is contained in:
@@ -2,27 +2,27 @@ locals {
|
|||||||
# Get current DHCP IPs from QEMU guest agent (from VM resource computed attribute)
|
# Get current DHCP IPs from QEMU guest agent (from VM resource computed attribute)
|
||||||
# Find first non-loopback, non-empty IP address from any interface
|
# Find first non-loopback, non-empty IP address from any interface
|
||||||
controlplane_dhcp_ips = [
|
controlplane_dhcp_ips = [
|
||||||
for vm in proxmox_virtual_environment_vm.controlplane :
|
for vm in proxmox_virtual_environment_vm.controlplane :
|
||||||
flatten([
|
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"]
|
[for ip in iface_ips : ip if ip != "127.0.0.1"]
|
||||||
])[0]
|
])[0]
|
||||||
]
|
]
|
||||||
|
|
||||||
worker_dhcp_ips = [
|
worker_dhcp_ips = [
|
||||||
for vm in proxmox_virtual_environment_vm.worker :
|
for vm in proxmox_virtual_environment_vm.worker :
|
||||||
flatten([
|
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"]
|
[for ip in iface_ips : ip if ip != "127.0.0.1"]
|
||||||
])[0]
|
])[0]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Use DHCP IPs for initial connection and configuration apply
|
# Use DHCP IPs for initial connection and configuration apply
|
||||||
# Note: If static IPs are configured via var.controlplane_ips/var.worker_ips,
|
# 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
|
# Talos will reconfigure the network after initial apply, but we connect via DHCP
|
||||||
controlplane_ips = local.controlplane_dhcp_ips
|
controlplane_ips = local.controlplane_dhcp_ips
|
||||||
worker_ips = local.worker_dhcp_ips
|
worker_ips = local.worker_dhcp_ips
|
||||||
|
|
||||||
# For client config and bootstrap, use static IPs if configured, otherwise DHCP
|
# 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
|
controlplane_endpoints = length(var.controlplane_ips) > 0 ? var.controlplane_ips : local.controlplane_dhcp_ips
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ resource "talos_machine_configuration_apply" "controlplane" {
|
|||||||
config_patches = concat(
|
config_patches = concat(
|
||||||
[
|
[
|
||||||
templatefile("${path.module}/templates/install-disk-and-hostname.yaml.tmpl", {
|
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", {
|
templatefile("${path.module}/templates/proxmox-ccm.yaml.tmpl", {
|
||||||
proxmox_url = var.proxmox_endpoint
|
proxmox_url = var.proxmox_endpoint
|
||||||
@@ -213,7 +213,7 @@ resource "talos_machine_configuration_apply" "worker" {
|
|||||||
config_patches = concat(
|
config_patches = concat(
|
||||||
[
|
[
|
||||||
templatefile("${path.module}/templates/install-disk-and-hostname.yaml.tmpl", {
|
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", {
|
templatefile("${path.module}/templates/proxmox-ccm.yaml.tmpl", {
|
||||||
proxmox_url = var.proxmox_endpoint
|
proxmox_url = var.proxmox_endpoint
|
||||||
|
|||||||
Reference in New Issue
Block a user