Open AaronFriel opened 1 year ago
Hi @AaronFriel,
latest
is supported by the DigitalOcean API as a convenience when creating a Kubernetes cluster. It is only supported in the Terraform provider in so far as the version
attribute is a string type. So if you set it to that, we'll send it to the API. We recommend specifying a specific version. The current valid versions can be found with doctl kubernetes options versions
If you want to automatically find and use the latest version, we do provide a data source, e.g:
data "digitalocean_kubernetes_versions" "example" {}
resource "digitalocean_kubernetes_cluster" "example-cluster" {
name = "example-cluster"
region = "nyc3"
version = data.digitalocean_kubernetes_versions.example.latest_version
node_pool {
name = "default"
size = "s-1vcpu-2gb"
node_count = 3
}
}
Though in most cases, you should still prefer using a static version for production workloads as this may lead to unplanned upgrades.
That makes sense, though it seems like the provider should forbid "latest", as refreshing the resource state will result in a different value being returned and subsequent plans & applies will try to apply "latest".
Alternatively,
Bug Report
Creating a Kubernetes Cluster with
version = latest
fails on subsequent updates.This was discovered by a Pulumi user here:
Describe the bug
Setting the version slug to "latest" works on creation, but applying the configuration again results in an API error:
If "latest" is supported as an input value, it should be supported on subsequent updates, as Terraform providers should generally be idempotent. A resource configuration that can only apply once results in user confusion.
Affected Resource(s)