Teardown

bash

kubectl delete -f documind-gitops/apps/
kubectl delete ingress documind-ingress -n documind
aws elbv2 describe-load-balancers --profile documind --query "LoadBalancers[].LoadBalancerName"

aws ecr list-images --profile documind --repository-name documind-backend --query "imageIds[*]" --output json > /tmp/i.json
aws ecr batch-delete-image --profile documind --repository-name documind-backend --image-ids file:///tmp/i.json
aws s3 rm s3://documind-dev-documents-<account-id> --recursive --profile documind

cd documind-infra/environments/dev
terraform destroy

If it errors on a dangling Elastic IP blocking IGW detachment:

bash

aws ec2 describe-addresses --profile documind --filters "Name=domain,Values=vpc" --query "Addresses[].AllocationId"
aws ec2 release-address --profile documind --allocation-id <id>
terraform destroy   # re-run

Verify nothing billable remains:

bash

aws eks list-clusters --profile documind
aws rds describe-db-instances --profile documind --query "DBInstances[].DBInstanceIdentifier"
aws ec2 describe-nat-gateways --profile documind --filter "Name=state,Values=available"

Redeployment

The real order, not just "re-run the phases" - see GOTCHAS.md for why each step is ordered this way:

  1. Phase 1 (bootstrap → VPC/EKS/RDS/S3/IRSA), then aws eks update-kubeconfig again.

  2. Apply all platform Helm releases together, before any ArgoCD Application:

   terraform apply \
     -target=helm_release.ingress_nginx \
     -target=helm_release.argocd \
     -target=helm_release.argo_rollouts \
     -target=helm_release.external_secrets \
     -target=helm_release.kube_prometheus_stack
   kubectl apply -f documind-gitops/apps/backend.yaml
   kubectl apply -f documind-gitops/apps/frontend.yaml
  1. Trigger CI/CD on documind-backend and documind-frontend to populate the (freshly empty) ECR repos:
git commit --allow-empty -m "chore: redeploy" && git push origin main
  1. Update module.dns's ingress_lb_hostname to the new NLB and terraform apply -target=module.dns last.
  2. Continue with Phases 8-11 as written.