Has anyone found a way to destroy/terminate namesp...
# helmfile
m
Has anyone found a way to destroy/terminate namespaces created by the Terraform resource kubernetes_namespace when they get stuck in the Terminating state? Right now, the only thing that seems to work is manually clearing the finalizers, like this:
kubectl get ns "$ns" -o json | jq 'del(.spec.finalizers)' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -
Just wondering if anyone's found a cleaner or automated way to handle this by terraform ?
👍 1
b
You may get better responses in #CB6GHNLG0
this 1
e
Short answer is not that I know about. Maybe you can get away with something like this: (sorry for the poor formatting; apparently no one at slack/Salesforce writes markdown on their phone.
Copy code
resource "kubernetes_namespace" "ns" {
metadata { name = var.namespace }
provisioner "local-exec" { when = destroy command = "echo destroying ${self.metadata[0].name}" } }