Terraform: delete loadbalancer created by k8s

#1

Hi,

I wonder how can I delete a load balancer created on Kapsule as described here: https://www.scaleway.com/en/docs/using-a-load-balancer-to-expose-your-kubernetes-kapsule-ingress-controller-service/

Thing is, I am creating everything via Terraform. So if I apply a terraform destroy, the LB is not destroyed, since it isn’t a terraform resource. How can it be deleted?

Best,

Francis

#2

Hello,

If you have destroyed your Terraform infrastructure and you have no longer need for the load balancer, you can delete it from the Load Balancer section of your Scaleway Console by clicking on the Loadbalancer -> Delete or by using the API: https://developers.scaleway.com/en/products/lb/api/#delete-264417

#3

Hi!

Thanks, but that defeats the purpose of automating things with Terraform…

#4

Hey @francis !
A new flag is available on the cluster destruction to destroy all associated resources (LBs, IPs and block storage). It’s not available yet in TF but I’ll try to add it next week!

#5

Great @PatrikCyvoct ! But I hope there’s a way to make it optional to destroy the IP’s, since the cool thing is actually to be able to reuse IP’s, specially when they are already pointed to from DNS.

#6

On the delete nop it’s all or nothing, at least for now. But with IP datasource in TF it should work well I think :slight_smile: