diff --git a/locals.tf b/locals.tf index b5ed686..7741b2c 100644 --- a/locals.tf +++ b/locals.tf @@ -10,7 +10,7 @@ locals { placement_group_id = null container_runtime = "containerd" tags = [] - wait_for_pool_ready = false + wait_for_pool_ready = true kubelet_args = null zone = null upgrade_policy = { diff --git a/node-pools.tf b/node-pools.tf index 81dc346..73e20c6 100644 --- a/node-pools.tf +++ b/node-pools.tf @@ -3,7 +3,7 @@ resource "scaleway_k8s_pool" "this" { region = var.region zone = lookup(each.value, "zone", local.node_pools_defaults["zone"]) cluster_id = scaleway_k8s_cluster.this.id - name = each.key + name = "${each.key}-${random_pet.this[each.key].id}" node_type = lookup(each.value, "node_type", local.node_pools_defaults["node_type"]) size = lookup(each.value, "size", local.node_pools_defaults["size"]) min_size = lookup(each.value, "min_size", local.node_pools_defaults["min_size"]) @@ -21,8 +21,16 @@ resource "scaleway_k8s_pool" "this" { tags = distinct(compact(concat(lookup(each.value, "tags", local.node_pools_defaults["tags"]), var.tags))) lifecycle { - ignore_changes = [ - size - ] + create_before_destroy = true + } +} + +resource "random_pet" "this" { + for_each = local.node_pools + keepers = { + placement_group_id = lookup(each.value, "placement_group_id", "") + zone = lookup(each.value, "zone", "") + container_runtime = lookup(each.value, "container_runtime", "") + node_type = lookup(each.value, "node_type", "") } }