Update prometheus-deployment.yaml #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Deploy Prometheus with Terraform" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Step 2: Setup Terraform | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| # Step 3: Configure kubeconfig | |
| - name: Configure kubeconfig | |
| run: | | |
| mkdir -p $HOME/.kube | |
| echo "${{ secrets.KUBECONFIG }}" | base64 -d > $HOME/.kube/config | |
| # Step 4: Terraform Init | |
| - name: Terraform Init | |
| run: terraform init | |
| # Step 5: Terraform Validate | |
| - name: Terraform Validate | |
| run: terraform validate | |
| # Step 6: Terraform Plan | |
| - name: Terraform Plan | |
| run: terraform plan -out=tfplan | |
| # Step 7: Terraform Apply (only on main branch) | |
| - name: Terraform Apply | |
| if: github.ref == 'refs/heads/main' | |
| run: terraform apply -auto-approve tfplan | |
| env: | |
| KUBECONFIG: $HOME/.kube/config |