diff --git a/control-planes.tf b/control-planes.tf index 90b48ca..3a1164a 100644 --- a/control-planes.tf +++ b/control-planes.tf @@ -111,6 +111,11 @@ resource "outscale_vm" "control-planes" { value = local.control_plane_names[count.index] } + tags { + key = "OscK8sClusterID/${var.cluster_name}" + value = "owned" + } + dynamic "tags" { for_each = var.public_cloud ? [1] : [] content { @@ -119,12 +124,3 @@ resource "outscale_vm" "control-planes" { } } } - -resource "outscale_tag" "control-planes-k8s-cluster-name" { - count = var.control_plane_count - resource_ids = [outscale_vm.control-planes[count.index].vm_id] - tag { - key = "OscK8sClusterID/${var.cluster_name}" - value = "owned" - } -} diff --git a/workers.tf b/workers.tf index d6a60a9..70764e8 100644 --- a/workers.tf +++ b/workers.tf @@ -102,6 +102,11 @@ resource "outscale_vm" "workers" { value = local.node_names[count.index] } + tags { + key = "OscK8sClusterID/${var.cluster_name}" + value = "owned" + } + dynamic "tags" { for_each = var.public_cloud ? [1] : [] content { @@ -110,14 +115,3 @@ resource "outscale_vm" "workers" { } } } - -# A bug in metadata make cloud-init crash with a tag containing a / so we apply it after VM finished starting. -# This tag is needed for CCM -resource "outscale_tag" "workers-k8s-cluster-name" { - count = var.worker_count - resource_ids = [outscale_vm.workers[count.index].vm_id] - tag { - key = "OscK8sClusterID/${var.cluster_name}" - value = "owned" - } -}