-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (42 loc) · 1.43 KB
/
ping-home-infra.yml
File metadata and controls
43 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
on:
push:
branches:
- "main"
paths:
- ".github/workflows/ping-home-infra.yml"
- "packages/ping-home/terraform/**"
jobs:
plan-and-apply:
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: packages/ping-home/terraform
env:
TF_VAR_github_repo: ${{ github.repository }}
TF_VAR_google_project: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
TF_VAR_google_region: ${{ secrets.GOOGLE_CLOUD_REGION }}
steps:
- uses: actions/checkout@v6
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- uses: google-github-actions/auth@v3
with:
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_CLOUD_TERRAFORM_SERVICE_ACCOUNT }}
- uses: hashicorp/setup-terraform@v3
- run: terraform init -backend-config="bucket=${{ secrets.TERRAFORM_STATE_BUCKET_NAME }}"
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- run: terraform plan -out=tfplan
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- run: terraform apply -auto-approve tfplan
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}