-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (68 loc) · 2.04 KB
/
lab5-gcp-uat1.yaml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: lab5-gcp-uat1
run-name: lab5-gcp-uat1
env:
google_project: lab5-gcp-uat1
workload_identity_provider: projects/869844840905/locations/global/workloadIdentityPools/github/providers/google-infra
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- lab5-gcp-uat1
permissions:
id-token: write
contents: read
jobs:
terraform-plan:
runs-on: ubuntu-latest
steps:
- id: checkout
name: Code Checkout
uses: actions/checkout@v4
- id: auth
name: Google Cloud Authentication
uses: google-github-actions/auth@v2
with:
project_id: ${{ env.google_project }}
workload_identity_provider: ${{ env.workload_identity_provider }}
- id: cache
name: Terraform Cache
uses: actions/cache@v4
with:
path: terraform/.terraform
key: ${{ runner.os }}-terraform-${{ hashFiles('terraform/.terraform.lock.hcl') }}
- id: terraform-plan
name: Terraform Plan
run: |-
google_project=${{ env.google_project }} make settings terraform-plan
terraform-apply:
runs-on: ubuntu-latest
environment: lab5-gcp-uat1
needs: terraform-plan
if: ${{ success() && github.ref == 'refs/tags/lab5-gcp-uat1' }}
steps:
- id: checkout
name: Code Checkout
uses: actions/checkout@v4
- id: auth
name: Google Cloud Authentication
uses: google-github-actions/auth@v2
with:
project_id: ${{ env.google_project }}
workload_identity_provider: ${{ env.workload_identity_provider }}
- id: cache
name: Terraform Cache
uses: actions/cache@v4
with:
path: terraform/.terraform
key: ${{ runner.os }}-terraform-${{ hashFiles('terraform/.terraform.lock.hcl') }}
- id: terraform-apply
name: Terraform Apply
run: |-
google_project=${{ env.google_project }} make settings terraform-apply