-
Notifications
You must be signed in to change notification settings - Fork 113
172 lines (154 loc) · 6.02 KB
/
scenario1.terraform.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: 'Scenario 1: Terraform Multi-Tenant ASEv3 Secure Baseline'
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: false
on:
workflow_dispatch:
inputs:
destroy:
description: 'Destroy resources?'
required: true
type: boolean
default: false
push:
branches:
- main
paths:
- '.github/workflows/scenario1.terraform.yml'
- '.github/workflows/_template.terraform.yml'
- 'scenarios/secure-baseline-multitenant/terraform/**.tf'
- 'scenarios/secure-baseline-multitenant/terraform/**/parameters/ase-multitenant.parameters.tfvars'
- '!scenarios/secure-baseline-multitenant/terraform/**.md'
pull_request:
branches:
- main
paths:
- '.github/workflows/scenario1.terraform.yml'
- '.github/workflows/_template.terraform.yml'
- 'scenarios/secure-baseline-multitenant/terraform/**'
- 'scenarios/secure-baseline-multitenant/terraform/**/parameters/ase-multitenant.parameters.tfvars'
- '!scenarios/secure-baseline-multitenant/terraform/**.md'
permissions:
id-token: write
contents: read
pull-requests: write
env:
modulePath: 'scenarios/secure-baseline-multitenant/terraform'
terraformVersion: 1.5.2 # must be greater than or equal to 1.2 for OIDC
backendStateKey: 'scenario1.hub.tfstate'
tfvarPath: 'parameters/ase-multitenant.parameters.tfvars'
jobs:
prepare-environment:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@main
outputs:
modulePath: ${{ env.modulePath }}
terraformVersion: ${{ env.terraformVersion }}
backendStateKey: ${{ env.backendStateKey }}
tfvarPath: ${{ env.tfvarPath }}
terraform-deploy-hub:
name: 'Terraform CICD (Hub Multi-tenant Secure Baseline)'
needs:
- prepare-environment
uses: ./.github/workflows/.template.terraform.yml
with:
modulePath: ${{ needs.prepare-environment.outputs.modulePath }}/hub
terraformVersion: ${{ needs.prepare-environment.outputs.terraformVersion }}
backendStateKey: 'scenario1.hub.tfstate'
tfvarPath: ${{ needs.prepare-environment.outputs.tfvarPath }}
# Ensure this value is a boolean
destroy: ${{ github.event.inputs.destroy == 'true' }}
secrets: inherit
terraform-deploy-spoke:
name: 'Terraform CICD (Spoke Multi-tenant Secure Baseline)'
needs:
- prepare-environment
- terraform-deploy-hub
uses: ./.github/workflows/.template.terraform.yml
with:
modulePath: ${{ needs.prepare-environment.outputs.modulePath }}/spoke
terraformVersion: ${{ needs.prepare-environment.outputs.terraformVersion }}
backendStateKey: 'scenario1.spoke.tfstate'
tfvarPath: ${{ needs.prepare-environment.outputs.tfvarPath }}
# Ensure this value is a boolean
destroy: ${{ github.event.inputs.destroy == 'true' }}
secrets: inherit
name: 'Scenario 1: Terraform Multi-Tenant ASEv3 Secure Baseline'
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: false
on:
workflow_dispatch:
inputs:
destroy:
description: 'Destroy resources?'
required: true
type: boolean
default: false
push:
branches:
- main
paths:
- '.github/workflows/scenario1.terraform.yml'
- '.github/workflows/_template.terraform.yml'
- 'scenarios/secure-baseline-multitenant/terraform/**.tf'
- 'scenarios/secure-baseline-multitenant/terraform/**/parameters/ase-multitenant.parameters.tfvars'
- '!scenarios/secure-baseline-multitenant/terraform/**.md'
pull_request:
branches:
- main
paths:
- '.github/workflows/scenario1.terraform.yml'
- '.github/workflows/_template.terraform.yml'
- 'scenarios/secure-baseline-multitenant/terraform/**'
- 'scenarios/secure-baseline-multitenant/terraform/**/parameters/ase-multitenant.parameters.tfvars'
- '!scenarios/secure-baseline-multitenant/terraform/**.md'
permissions:
id-token: write
contents: read
pull-requests: write
env:
modulePath: 'scenarios/secure-baseline-multitenant/terraform'
terraformVersion: 1.5.2 # must be greater than or equal to 1.2 for OIDC
backendStateKey: 'scenario1.hub.tfstate'
tfvarPath: 'parameters/ase-multitenant.parameters.tfvars'
jobs:
prepare-environment:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@main
outputs:
modulePath: ${{ env.modulePath }}
terraformVersion: ${{ env.terraformVersion }}
backendStateKey: ${{ env.backendStateKey }}
tfvarPath: ${{ env.tfvarPath }}
terraform-deploy-hub:
name: 'Terraform CICD (Hub Multi-tenant Secure Baseline)'
needs:
- prepare-environment
uses: ./.github/workflows/.template.terraform.yml
with:
modulePath: ${{ needs.prepare-environment.outputs.modulePath }}/hub
terraformVersion: ${{ needs.prepare-environment.outputs.terraformVersion }}
backendStateKey: 'scenario1.hub.tfstate'
tfvarPath: ${{ needs.prepare-environment.outputs.tfvarPath }}
# Ensure this value is a boolean
destroy: ${{ github.event.inputs.destroy == 'true' }}
secrets: inherit
terraform-deploy-spoke:
name: 'Terraform CICD (Spoke Multi-tenant Secure Baseline)'
needs:
- prepare-environment
- terraform-deploy-hub
uses: ./.github/workflows/.template.terraform.yml
with:
modulePath: ${{ needs.prepare-environment.outputs.modulePath }}/spoke
terraformVersion: ${{ needs.prepare-environment.outputs.terraformVersion }}
backendStateKey: 'scenario1.spoke.tfstate'
tfvarPath: ${{ needs.prepare-environment.outputs.tfvarPath }}
# Ensure this value is a boolean
destroy: ${{ github.event.inputs.destroy == 'true' }}
secrets: inherit