Closed jpetazzo closed 1 year ago
Hello @jpetazzo, Great subject about the related resources. The terraform provider today can't handle the related resource created from k8s as you noticed. Even though, change this as a required argument it's interesting to be more explicit in its use.
Community Note
Description
In
scaleway_k8s_cluster
, the argumentdelete_additional_resources
is optional, and defaults tofalse
.As a result, if I create a bunch of Kapsule clusters, then create LoadBalancer services, volumes, etc., then delete these clusters, I still have a bunch of resources in my account and get charged for them. That's unexpected, because usually when I
terraform destroy
I expect all resources to be deleted.I understand that we wan't to be super-duper careful with data (i.e. Persistent Volumes) and not delete them; however I can't imagine any scenario where someone would want to keep their Kapsule load balancers. (In theory, someone might want to delete the cluster and keep the IP address of the LB; in practice since the LB can't be attached to a new cluster, I can't imagine a real world scenario where someone would really want to do that. And it's 2021 so if you know how to deploy a Kubernetes cluster you probably know how to update a DNS record 😅)
So in a perfect world, we might want to have a different behavior here, e.g. automatically delete LoadBalancer but keep PersistentVolumes, or even let the user pick what the default StorageClass policy should be (Retain vs Delete), but all these things would involve quite a bit of work; so instead I suggest something simpler:
_The
delete_additional_resources
argument should be mandatory!_That way, folks can decide whether or not to keep these resources (and whether or not to get charged for them) right away (instead of discovering that they have 20 Load Balancers still running on their next billing cycle).
New or Affected Resource(s)
scaleway_k8s_cluster
Potential Terraform Configuration
See https://github.com/jpetazzo/container.training/tree/cd9751a7658d18a46bb03d4b4a991552933758bf/prepare-tf/modules/scaleway for an example. Ideally I'd like this particular config to warn me because I might be charged for resources after deleting the cluster.