civo/terraform-provider-civo

[BUG] changing cluster_type in civo_kubernetes_cluster does nothing after creation

Closed this issue · 4 comments

Description

Issue

We do not support changing cluster_type after creation. When you change this value it does nothing.

provider "civo" {
  region = "LON1"
}


data "civo_size" "xsmall" {
    filter {
        key = "type"
        values = ["kubernetes"]
    }

    sort {
        key = "ram"
        direction = "asc"
    }
}

resource "civo_kubernetes_cluster" "my-cluster" {
    name = "my-cluster"
    applications = "mariadb:5GB"
    # cluster_type = "talos" #uncomment this after creation
    firewall_id = civo_firewall.my-firewall.id
    pools {
        label = "front-end" // Optional
        size = element(data.civo_size.xsmall.sizes, 0).name
        node_count = 2
    }
}

Acceptance criteria

  • Error out whenever user tries to change the cluster type after creation: "cluster_type cannot be changed after cluster has been created. If you wish to change the cluster type, either create another cluster of a different type or destroy this one first"

Screenshots

No response

Additional information

No response

Hi @uzaxirr,

For cluster_type attribute there is no HasChange check in resourceKubernetesClusterUpdate(). Adding one and returning an error from that might potentially solve this issue.

Could you kindly review this whenever you have time?

Regards!

the approach seems good, go ahead!

you can do something like

	if d.HasChange("cluster_type") {
		config.ClusterType = d.Get("cluster_type").(string)
		
	}

make sure to test out the change locally and attach the corresponding screen shots in your PR

Hey @uzaxirr , Before I proceed, can you kindly check this, since both issues look similar.

#258 (comment)

Also, for this issue, should I error out as described in the issue, or update the config?