11name : Terraform Infrastructure
2-
32on :
43 workflow_dispatch :
54 workflow_call :
1312 terraform-result :
1413 description : " Terraform execution result"
1514 value : ${{ jobs.terraform.outputs.result }}
16-
1715jobs :
1816 terraform :
1917 name : Terraform Deployment
@@ -25,27 +23,22 @@ jobs:
2523 steps :
2624 - name : Checkout Repository
2725 uses : actions/checkout@v5
28-
2926 - name : Login to AWS
3027 uses :
aws-actions/[email protected] 3128 with :
3229 aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
3330 aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
3431 aws-region : us-east-1
35-
3632 - name : Setup Terraform
37333834 with :
3935 terraform_version : 1.5.7
40-
4136 - name : Terraform Init
4237 run : terraform init
4338 working-directory : ./Terraform
44-
4539 - name : Terraform Plan
4640 run : terraform plan
4741 working-directory : ./Terraform
48-
4942 - name : Terraform Apply
5043 id : terraform-apply
5144 if : ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
@@ -59,19 +52,16 @@ jobs:
5952 if : ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
6053 run : |
6154 aws eks update-kubeconfig --name otel-cluster --region us-east-1
62-
6355 - name : Install Helm
6456 if : ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
65576658 with :
6759 version : v3.14.0
68-
6960 - name : Add ArgoCD Helm Repo
7061 if : ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
7162 run : |
7263 helm repo add argo https://argoproj.github.io/argo-helm
7364 helm repo update
74-
7565 - name : Install/Upgrade ArgoCD
7666 if : ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
7767 run : |
@@ -81,24 +71,16 @@ jobs:
8171 --set server.service.type=LoadBalancer \
8272 --wait
8373
84- # ---------------------------
85- # Get ArgoCD Server URL
86- # ---------------------------
87- - name : Get ArgoCD URL
74+ - name : Create Grafana Secret
8875 if : ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
8976 run : |
90- echo "Waiting for ArgoCD LoadBalancer..."
91- kubectl wait --for=condition=available deployment/argocd-server -n argocd --timeout=300s || true
92-
93- ARGOCD_URL=$(kubectl get svc argocd-server -n argocd -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
94- if [ -z "$ARGOCD_URL" ]; then
95- ARGOCD_URL=$(kubectl get svc argocd-server -n argocd -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
96- fi
97-
98- echo "ArgoCD URL: http://$ARGOCD_URL"
77+ kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
78+ kubectl create secret generic grafana-admin-secret \
79+ --from-literal=admin-password='${{ secrets.GRAFANA_ADMIN_PASSWORD }}' \
80+ --namespace monitoring \
81+ --dry-run=client -o yaml | kubectl apply -f -
9982
100- PASS=$(kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 --decode)
101- echo "username=admin"
102- echo "password=$PASS"
103-
104-
83+ - name : Deploy Monitoring
84+ if : ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
85+ run : |
86+ kubectl apply -f ./argocd/monitoring-stack.yaml
0 commit comments