vultr / terraform-provider-vultr

Terraform Vultr provider
https://www.terraform.io/docs/providers/vultr/
Mozilla Public License 2.0
193 stars 65 forks source link

[BUG] - Upgrade of K8S cluster not possible through provider #281

Closed fredriklindberg closed 1 year ago

fredriklindberg commented 2 years ago

Describe the bug A change to the K8S version of a deployed cluster causes a re-creation of the cluster rather than triggering a cluster control plane upgrade. The full state of the existing cluster is lost.

This makes it impossible to control the version of upgrades through the terraform.

Provider version: 2.11.4

> terraform apply
...
  # vultr_kubernetes.vke must be replaced
-/+ resource "vultr_kubernetes" "vke" {
      ~ cluster_subnet = "10.244.0.0/16" -> (known after apply)
      ~ date_created   = "2022-08-21T13:40:39+00:00" -> (known after apply)
      ~ endpoint       = "f666e678-d5b9-4701-8141-0a60f18753d0.vultr-k8s.com" -> (known after apply)
      ~ id             = "f666e678-d5b9-4701-8141-0a60f18753d0" -> (known after apply)
      ~ ip             = "..." -> (known after apply)
      ~ kube_config    = "..." (known after apply)
      ~ service_subnet = "10.96.0.0/12" -> (known after apply)
      ~ status         = "active" -> (known after apply)
      ~ version        = "v1.23.7+2" -> "v1.24.3+2" # forces replacement
        # (2 unchanged attributes hidden)

      ~ node_pools {
          ~ date_created  = "2022-08-21T13:40:40+00:00" -> (known after apply)
          ~ date_updated  = "2022-08-21T13:44:02+00:00" -> (known after apply)
          ~ id            = "42337069-4d89-4322-88a3-51ce6a3656df" -> (known after apply)
          ~ nodes         = [
              - {
                  - date_created = "2022-08-21T13:40:40+00:00"
                  - id           = "f9975402-4bb8-47d0-8e20-16e815cce609"
                  - label        = "vke-test-pool-5237bdd54a75"
                  - status       = "active"
                },
              - {
                  - date_created = "2022-08-21T13:40:40+00:00"
                  - id           = "f1923c77-92b4-46c5-b35a-8eb511812a50"
                  - label        = "vke-test-pool-2407e09e70a2"
                  - status       = "active"
                },
            ] -> (known after apply)
          ~ status        = "active" -> (known after apply)
          ~ tag           = "tf-vke-default" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
    }

Plan: 1 to add, 0 to change, 1 to destroy.

To Reproduce

  1. Create and deploy a K8S cluster using the vultr_kubernetes resource with version set to v1.23.7+2
  2. Update the version field to v1.24.3+2
  3. Run terraform apply
  4. The provider will destroy the existing cluster and provision a new.

Expected behavior A change of version to an existing K8S cluster should trigger a control plane upgrade (https://www.vultr.com/api/#operation/start-kubernetes-cluster-upgrade), not re-creation of the cluster.

optik-aper commented 2 years ago

Thanks for the report. That definitely needs to be fixed.