Skip to content

Commit

Permalink
incl. for_each
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvveen committed Jan 9, 2025
1 parent 1ecd8f5 commit ad0f34c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions 03-talos.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ module "talos_worker_group" {
resource "talos_machine_secrets" "this" {}

data "talos_machine_configuration" "controlplane" {
count = var.controlplane_count
for_each = { for index in range(0, var.controlplane_count) : index => index }

cluster_name = var.cluster_name
cluster_endpoint = "https://${module.elb_k8s_elb.elb_dns_name}"
machine_type = "controlplane"
Expand All @@ -66,7 +66,7 @@ data "talos_machine_configuration" "controlplane" {
machine = {
kubelet = {
extraArgs = {
hostname-override = module.talos_control_plane_nodes[count.index].id
hostname-override = module.talos_control_plane_nodes[each.key].id
}
}
}
Expand Down Expand Up @@ -109,7 +109,6 @@ data "talos_machine_configuration" "worker_group" {

resource "talos_machine_configuration_apply" "controlplane" {
count = var.controlplane_count

client_configuration = talos_machine_secrets.this.client_configuration
machine_configuration_input = data.talos_machine_configuration.controlplane[count.index].machine_configuration
endpoint = module.talos_control_plane_nodes[count.index].public_ip
Expand All @@ -136,7 +135,6 @@ resource "talos_machine_bootstrap" "this" {
data "talos_client_configuration" "this" {
cluster_name = var.cluster_name
client_configuration = talos_machine_secrets.this.client_configuration
endpoints = module.talos_control_plane_nodes.*.public_ip
}

resource "local_file" "talosconfig" {
Expand Down

0 comments on commit ad0f34c

Please sign in to comment.