-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (108 loc) · 3.76 KB
/
terraform_main.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
name: "Terraform: Main"
on:
push:
branches:
- main
jobs:
generate_jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: Determine changes
uses: ./.github/actions/generate/jobs
- id: accounts-terraform-jobs
name: Generate Terraform matrix for Accounts
uses: ./.github/actions/generate/jobs/terraform
with:
includes: accounts # we'll manage accounts separately in a job before the others.
- id: iam-terraform-jobs
name: Generate Terraform matrix for IAM
uses: ./.github/actions/generate/jobs/terraform
with:
includes: iam # we'll manage iam separately in a job before the others.
- id: remaining-terraform-jobs
name: Generate Terraform matrix for remaining jobs
uses: ./.github/actions/generate/jobs/terraform
with:
excludes: accounts,iam # we'll manage accounts and iam separately in a job before the others.
outputs:
accounts-terraform-jobs: ${{ steps.accounts-terraform-jobs.outputs.terraform-jobs }}
iam-terraform-jobs: ${{ steps.iam-terraform-jobs.outputs.terraform-jobs }}
remaining-terraform-jobs: ${{ steps.remaining-terraform-jobs.outputs.terraform-jobs }}
terraform_apply_accounts:
if: ${{ needs.generate_jobs.outputs.accounts-terraform-jobs != '[]' }}
name: "Apply accounts"
needs:
- generate_jobs
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
strategy:
fail-fast: false
matrix:
terraform-job: ${{ fromJson(needs.generate_jobs.outputs.accounts-terraform-jobs) }}
concurrency: "${{ matrix.terraform-job }}"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Authenticate
uses: ./.github/actions/auth
with:
role_name: gha-vjftw-infrastructure-main
- name: "${{ matrix.terraform-job }}"
run: |-
./pleasew -p -v2 run //build/ci/github/branch:terraform_apply -- --please_target "${{ matrix.terraform-job }}"
terraform_apply_iam:
if: ${{ needs.generate_jobs.outputs.iam-terraform-jobs != '[]' }}
name: "Apply IAM"
needs:
- generate_jobs
- terraform_apply_accounts
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
strategy:
fail-fast: false
matrix:
terraform-job: ${{ fromJson(needs.generate_jobs.outputs.iam-terraform-jobs) }}
concurrency: "${{ matrix.terraform-job }}"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Authenticate
uses: ./.github/actions/auth
with:
role_name: gha-vjftw-infrastructure-main
- name: "${{ matrix.terraform-job }}"
run: |-
./pleasew -p -v2 run //build/ci/github/branch:terraform_apply -- --please_target "${{ matrix.terraform-job }}"
terraform_apply_remaining:
if: ${{ needs.generate_jobs.outputs.remaining-terraform-jobs != '[]' }}
name: "Apply remaining"
needs:
- generate_jobs
- terraform_apply_iam
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
strategy:
fail-fast: false
matrix:
terraform-job: ${{ fromJson(needs.generate_jobs.outputs.remaining-terraform-jobs) }}
concurrency: "${{ matrix.terraform-job }}"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Authenticate
uses: ./.github/actions/auth
with:
role_name: gha-vjftw-infrastructure-main
- name: "${{ matrix.terraform-job }}"
run: |-
./pleasew -p -v2 run //build/ci/github/branch:terraform_apply -- --please_target "${{ matrix.terraform-job }}"