move random_pet to host module

This commit is contained in:
phaer
2022-03-05 15:25:43 +01:00
parent 3337a6a4f5
commit d08a350362
4 changed files with 27 additions and 14 deletions

View File

@@ -1,14 +1,9 @@
resource "random_pet" "agents" {
count = length(local.agent_nodepools)
length = 1
}
module "agents" {
source = "./modules/host"
for_each = local.agent_nodepools
name = var.use_cluster_name_in_node_name ? "${random_pet.cluster.id}-${each.value.nodepool_name}-${random_pet.agents[each.value.index].id}" : "${each.value.nodepool_name}-${random_pet.agents[each.value.index].id}"
name = "${var.use_cluster_name_in_node_name ? "${random_pet.cluster.id}-" : ""}${each.value.nodepool_name}"
ssh_keys = [hcloud_ssh_key.k3s.id]
public_key = var.public_key
private_key = var.private_key