I am using a combination of ArgoCD, FluxCD and Terraform to provision infrastructure resources in a GitOps way. Each technology has each function:
- Terraform: a module that contains all the infrastructure resources to be created
- FluxCD: using the Terraform controller to plan + apply the previous Terraform module
- ArgoCD: deploys an application that points to a chart which creates the FluxCD Terraform CR
When I create the ArgoCD application all works good: Terraform CR is created and after a couple of minutes the infra is provisioned. The problem comes at the deletion process. When I delete the ArgoCD application, all resources are deleted (even the Terraform CR) but the infra resources are intact. If I delete the Terraform CR manually the infra is properly destroyed after some seconds, so I am thinking that Argo is removing it directly giving no time to it to destroy the infra.
I have tried using a Job and a Helm pre delete hook but it seems not to work when deploying the chart using Argo. I have seem the Argo waves and hooks, but after a quick research it seems not solve the problem.