diff --git a/.github/workflows/tf-check-secure-estimate.yml b/.github/workflows/tf-check-secure-estimate.yml index 2a6efa9..e5310d6 100644 --- a/.github/workflows/tf-check-secure-estimate.yml +++ b/.github/workflows/tf-check-secure-estimate.yml @@ -10,8 +10,6 @@ permissions: pull-requests: write env: - AWS_ACCESS_KEY_ID : "${{ secrets.AWS_ACCESS_KEY_ID }}" - AWS_SECRET_ACCESS_KEY : "${{ secrets.AWS_SECRET_ACCESS_KEY }}" TF_ROOT : "." jobs: @@ -32,7 +30,7 @@ jobs: # Initialize a new or existing Terraform working directory - name: Terraform Init - run: terraform init + run: terraform init -backend=false # Validate terraform files - name: Terraform Validate @@ -98,14 +96,9 @@ jobs: with: terraform_wrapper: false - # Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. - name: Terraform Init - run: terraform init + run: terraform init -backend=false - # Plan change - - name: Terraform Plan - run: terraform plan - - name: Setup Infracost uses: infracost/actions/setup@v2 with: diff --git a/.github/workflows/tf-plan-apply.yml b/.github/workflows/tf-plan-apply.yml index b497793..1a0a726 100644 --- a/.github/workflows/tf-plan-apply.yml +++ b/.github/workflows/tf-plan-apply.yml @@ -14,6 +14,7 @@ permissions: env: AWS_ACCESS_KEY_ID : "${{ secrets.AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY : "${{ secrets.AWS_SECRET_ACCESS_KEY }}" + GOOGLE_APPLICATION_CREDENTIALS : /tmp/gcp.creds TF_ROOT : "." jobs: @@ -27,6 +28,13 @@ jobs: tfplanExitCode: ${{ steps.tf-plan.outputs.exitcode }} steps: + # Set-up Google authentication if configured + - name: Set-up GCP auth + if: ${{ env.GOOGLE_APPLICATION_CREDENTIALS_CONTENT != '' }} + run: cat - <<<"${GOOGLE_APPLICATION_CREDENTIALS_CONTENT}" > "$GOOGLE_APPLICATION_CREDENTIALS" + env: + GOOGLE_APPLICATION_CREDENTIALS_CONTENT: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_CONTENT }}" + # Checkout the repository to the GitHub Actions runner - name: Checkout uses: actions/checkout@v3 @@ -119,6 +127,13 @@ jobs: needs: [terraform-plan] steps: + # Set-up Google authentication if configured + - name: Set-up GCP auth + if: ${{ env.GOOGLE_APPLICATION_CREDENTIALS_CONTENT != '' }} + run: cat - <<<"${GOOGLE_APPLICATION_CREDENTIALS_CONTENT}" > "$GOOGLE_APPLICATION_CREDENTIALS" + env: + GOOGLE_APPLICATION_CREDENTIALS_CONTENT: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_CONTENT }}" + # Checkout the repository to the GitHub Actions runner - name: Checkout uses: actions/checkout@v3