-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 1.51 KB
/
iam-apply.yml
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
name: Apply(IAM mode)
on:
push:
branches:
- master
jobs:
apply:
permissions:
id-token: write
pull-requests: write
name: Apply
runs-on: ubuntu-latest
strategy:
matrix:
dir: [
terraform/iam
]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check diff
id: diff
uses: technote-space/[email protected]
with:
PATTERNS: |
${{ matrix.dir }}/**/*.tf
- name: Authenticate to GCP
if: env. GIT_DIFF_FILTERED
id: gcp_auth
uses: google-github-actions/[email protected]
with:
create_credentials_file: 'true'
workload_identity_provider: projects/233207969476/locations/global/workloadIdentityPools/github-action/providers/github-action-provider
service_account: [email protected]
access_token_lifetime: 1200s
- name: gcloud auth login by workload identity
if: env. GIT_DIFF_FILTERED
run: |-
gcloud auth login --brief --cred-file="${{ steps.gcp_auth.outputs.credentials_file_path }}"
- name: Setup terraform
if: env. GIT_DIFF_FILTERED
uses: hashicorp/[email protected]
with:
terraform_version: 1.0.11
- name: Apply
if: env. GIT_DIFF_FILTERED
run: |
cd ${{ matrix.dir }}
terraform init
terraform get
terraform apply -auto-approve
shell: bash