data "template_file" "control_plane_cloud_init" { count = var.control_plane_count template = file("${path.module}/files/cloud_init_global.tpl") vars = { hostname = "cp-${count.index + 1}" domain = "home.arpa" SSH_KEY_PUBLIC = var.SSH_KEY_PUBLIC } } resource "local_file" "control_plane_cloud_init" { count = var.control_plane_count content = data.template_file.control_plane_cloud_init[count.index].rendered filename = "${path.module}/files/rendered/cp-${count.index + 1}.yaml" } data "template_file" "worker_cloud_init" { count = var.worker_count template = file("${path.module}/files/cloud_init_global.tpl") vars = { hostname = "wk-${count.index + 1}" domain = "home.arpa" SSH_KEY_PUBLIC = var.SSH_KEY_PUBLIC } } resource "local_file" "worker_cloud_init" { count = var.worker_count content = data.template_file.worker_cloud_init[count.index].rendered filename = "${path.module}/files/rendered/wk-${count.index + 1}.yaml" }