yandex-cloud / terraform-provider-yandex

Terraform Yandex provider
https://www.terraform.io/docs/providers/yandex/
Mozilla Public License 2.0
208 stars 113 forks source link

Cannot convert zonal k8s cluster to regional #470

Open akamac opened 13 hours ago

akamac commented 13 hours ago

The docs say:

master_location - (Optional) Cluster master's instances locations array (zone and subnet). Cannot be used together with zonal or regional. Currently, supports either one, for zonal master, or three instances of master_location. Can be updated inplace. When creating regional cluster (three master instances), its region will be evaluated automatically by backend. The structure is documented below.

In reality, when I change from 1 to 3 location blocks, I get error master_spec.locations: more than one locations specified for zonal cluster:

  ~ update in-place
Terraform will perform the following actions:
  # yandex_kubernetes_cluster.kubernetes_cluster will be updated in-place
  ~ resource "yandex_kubernetes_cluster" "kubernetes_cluster" {
        id                       = "***"
        name                     = "***"
        # (12 unchanged attributes hidden)
      ~ master {
            # (8 unchanged attributes hidden)
          ~ master_location {
              ~ subnet_id = "***" -> "***"
              ~ zone      = "ru-central1-d" -> "ru-central1-a"
            }
          + master_location {
              + subnet_id = "***"
              + zone      = "ru-central1-b"
            }
          + master_location {
              + subnet_id = "***"
              + zone      = "ru-central1-d"
            }
            # (3 unchanged blocks hidden)
        }
        # (2 unchanged blocks hidden)
    }
vladkanatov commented 12 hours ago

Cannot be used together with zonal or regional.

Unfortunately, it is not possible to directly change a zonal cluster to a regional one without deleting the cluster. You should create a new cluster, migrate data there and delete the old one. This restriction applies to all cloud services where there is a distinction between zonal and regional clusters. The next time you create a cluster, pay attention to this aspect.