I am installing argocd
into my Kubernetes clusters with helm in Terraform like so:
resource "kubernetes_namespace" "ns_argocd" {
metadata {
annotations = {
name = "argocd"
}
name = "argocd"
}
}
resource "helm_release" "argocd" {
name = "argocd"
repository = "https://argoproj.github.io/argo-helm"
chart = "argo-cd"
version = "3.27.1"
create_namespace = false
namespace = kubernetes_namespace.ns_argocd.0.metadata.0.name
depends_on = [kubernetes_namespace.ns_argocd]
}
It works really nice, I can create applications, deploy resources and so on. But if I try to run a terraform destroy
, the deletion of the namespace argocd
gets stuck with status terminating
. This is because the applications defined in the argocd namespace are not correctly removed and I had to do some workarounds to delete it manually, mainly removing the finalizers from the definition.
Is there a way that running the destroy
command will remove the applications defined in the argocd
namespace when deleting the namespace?