We are using terraform to provision our AWS EKS cluster. The terraform code includes creating required security groups, creating the EKS cluster, shell script which has helm commands to install istio as null resource
resource “null_resource” “helm_destroy” {
provisioner “local-exec” {
when = “destroy”
command = “sh {path.module}/Scripts/bin/helm_destroy.sh {aws_eks_cluster.master_node.name}”
}
}
and last we have shell script to run helm delete commands, this script will be triggered only when we run destroy.
This is working fine when we are provisioning but when we run terraform destroy, before the destroy script destroys everything, the security group is getting deleted due to that the delete shell script is not able to complete its task. Is there way I can add a dependency that the security group should be deleted only after the helm delete null resoruce completes.