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_fqdn = "${var.cluster_name}.${var.local_domain}" cluster_endpoint = "https://${local.cluster_fqdn}:${var.cluster_api_port}" cluster_api_ipv4_address = data.dns_a_record_set.cluster_api_ipv4_address.addrs[0] cluster_api_ipv6_address = data.dns_aaaa_record_set.cluster_api_ipv6_address.addrs[0] machine_config_patches = { for guest in var.vm_guests: guest.name => [ templatefile("${path.root}/templates/talos_machine_config.yml.tftpl", { hostname = guest.name local_domain = var.local_domain cluster_fqdn = local.cluster_fqdn cluster_api_ipv4_address = local.cluster_api_ipv4_address cluster_api_ipv6_address = local.cluster_api_ipv6_address ipv4_address = data.dns_a_record_set.guests[guest.name].addrs[0] ipv6_address = data.dns_aaaa_record_set.guests[guest.name].addrs[0] }), templatefile("${path.root}/templates/talos_cluster_config.yml.tftpl", { cluster_name = var.cluster_name cluster_fqdn = local.cluster_fqdn cluster_endpoint = local.cluster_endpoint cluster_api_port = var.cluster_api_port cluster_api_ipv4_address = local.cluster_api_ipv4_address cluster_api_ipv6_address = local.cluster_api_ipv6_address ipv4_pod_cidr = var.ipv4_pod_cidr ipv6_pod_cidr = var.ipv6_pod_cidr ipv4_service_cidr = var.ipv4_service_cidr ipv6_service_cidr = var.ipv6_service_cidr discovery_service_endpoint = var.discovery_service_endpoint }), templatefile("${path.root}/templates/talos_hostname_config.yml.tftpl", { hostname = guest.name local_domain = var.local_domain }), templatefile("${path.root}/templates/talos_link_config.yml.tftpl", { ipv4_address = data.dns_a_record_set.guests[guest.name].addrs[0] ipv6_address = data.dns_aaaa_record_set.guests[guest.name].addrs[0] ipv4_subnet_mask = var.ipv4_subnet_mask ipv4_gateway = var.ipv4_gateway ipv6_gateway = var.ipv6_gateway }), templatefile("${path.root}/templates/talos_resolver_config.yml.tftpl", { ipv4_nameservers = var.ipv4_nameservers ipv6_nameservers = var.ipv6_nameservers search_domains = var.search_domains }), templatefile("${path.root}/templates/talos_timesync_config.yml.tftpl", { ipv4_ntp_servers = var.ipv4_ntp_servers ipv6_ntp_servers = var.ipv6_ntp_servers }), file("${path.root}/files/talos_kubespan_config.yml") ] if contains(["controlplane", "worker"], guest.role)} }