Skip to content

Commit

Permalink
new gcloud sdk auth pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrea committed Mar 21, 2024
1 parent ff9224e commit c2dc2f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/tf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,21 @@ jobs:
# pull prod file if we are on main otherwise dev
# GH Action error: Terraform lint and apply
# changed 'google-github-actions/setup-gcloud@master' ---> 'google-github-actions/setup-gcloud@v0'
- uses: google-github-actions/setup-gcloud@v2
- uses: google-github-actions/auth@v2
if: github.ref == 'refs/heads/main'
with:
service_account_key: ${{ secrets.SA_VARS_PROD }}
export_default_credentials: false

- uses: google-github-actions/setup-gcloud@v2
- uses: google-github-actions/auth@v2
if: github.ref != 'refs/heads/main'
with:
service_account_key: ${{ secrets.SA_VARS_DEV }}
export_default_credentials: false

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'

- name: Get tfvars file
if: github.ref == 'refs/heads/main'
run: gsutil cp gs://${{ secrets.GCP_TFVAR_BUCKET_PROD }}/terraform.tfvars ./terraform.tfvars
Expand Down

0 comments on commit c2dc2f8

Please sign in to comment.