terraform-provider-scaleway
terraform-provider-scaleway copied to clipboard
scaleway_k8s_cluster: delete_additional_resources shouldn't be optional
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
In scaleway_k8s_cluster, the argument delete_additional_resources is optional, and defaults to false.
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.
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.