From 8792a3cbddb5bd762b71b4f91d26bacda26f5e96 Mon Sep 17 00:00:00 2001 From: AbhishekHS220 Date: Wed, 4 Jun 2025 11:15:11 +0530 Subject: [PATCH] Update onix-gcp-terraform-deploy.yml --- .../workflows/onix-gcp-terraform-deploy.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/onix-gcp-terraform-deploy.yml b/.github/workflows/onix-gcp-terraform-deploy.yml index f37932a..a0544c4 100644 --- a/.github/workflows/onix-gcp-terraform-deploy.yml +++ b/.github/workflows/onix-gcp-terraform-deploy.yml @@ -30,6 +30,12 @@ jobs: with: terraform_version: 1.5.0 + - name: Authenticate to Google Cloud + run: echo "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}" > gcp-key.json + + - name: Export GCP Credentials to Terraform + run: echo "GOOGLE_APPLICATION_CREDENTIALS=$GITHUB_WORKSPACE/gcp-key.json" >> $GITHUB_ENV + - name: Create backend.tf and Terraform Init working-directory: ./gerrit-repo/Terraform-CICD env: @@ -46,19 +52,6 @@ jobs: EOF terraform init - - - name: Create provider.tf with credentials - working-directory: ./gerrit-repo/Terraform-CICD - run: | - cat < provider.tf - provider "google" { - credentials = "${{ github.workspace }}/gcp-key.json" - project = "trusty-relic-370809" - region = "asia-south1" - } - EOF - - - name: Terraform Plan working-directory: ./gerrit-repo/Terraform-CICD