Skip to content

Commit 6dc1e62

Browse files
committed
Enhance ArgoCD application management by adding kubectl configuration for EKS cluster in both creation and destruction processes
1 parent efd1aba commit 6dc1e62

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Terraform/3-main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ resource "time_sleep" "wait_for_argocd" {
5252
resource "null_resource" "solar_system_app" {
5353
provisioner "local-exec" {
5454
command = <<EOF
55+
# Configure kubectl to use EKS cluster
56+
aws eks update-kubeconfig --name ${module.eks.cluster_name} --region us-east-1
57+
5558
# Wait for ArgoCD CRDs to be available
5659
kubectl wait --for condition=established --timeout=300s crd/applications.argoproj.io
5760
@@ -83,7 +86,11 @@ EOF
8386

8487
provisioner "local-exec" {
8588
when = destroy
86-
command = "kubectl delete application solar-system -n argocd --ignore-not-found=true"
89+
command = <<EOF
90+
# Configure kubectl for destroy
91+
aws eks update-kubeconfig --name ${module.eks.cluster_name} --region us-east-1 || true
92+
kubectl delete application solar-system -n argocd --ignore-not-found=true
93+
EOF
8794
}
8895

8996
depends_on = [time_sleep.wait_for_argocd]

0 commit comments

Comments
 (0)