-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
470 lines (462 loc) · 17.2 KB
/
locals.tf
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
locals {
# This local is used to define the Terraform Cloud organization name.
tfc_organization_name = "ConseilsTI"
# This local is used to define Terraform Cloud OAuth client name.
tfc_oauth_client_name = "GitHub.com (ConseilsTI)"
# This local is used to define all required secrets that we have to read from Hashicorp Vault Secrets.
hcp_vault_secrets = [
# `hcp_vault_secrets` is a list of object.
# Here is an example of an object:
# {
# app_name = ""
# secret = ""
# }
{
app_name = "GitHub"
secret = "GITHUB_APP_ID"
},
{
app_name = "GitHub"
secret = "GITHUB_APP_INSTALLATION_ID"
},
{
app_name = "GitHub"
secret = "GITHUB_APP_PEM_FILE"
},
{
app_name = "GitHub"
secret = "GITHUB_OWNER"
},
{
app_name = "HashicorpCloud"
secret = "HCP_CLIENT_ID"
},
{
app_name = "HashicorpCloud"
secret = "HCP_CLIENT_SECRET"
}
]
# This local is used to defined the Hashicorp Vault Secrets app name where team token will be stored.
hcp_vault_secrets_app_name = "TerraformCloud"
# This local is used to define teams at the organization level.
tfc_organization_teams = [
# `tfc_organization_teams` is a list of object.
# Each object must contain an `organization_access` argument with the team's organization access.
# Refer to "./modules/tfe_team/README.md" for more details on the permissions type.
# Here is an example of an object:
# {
# name = ""
# members = ["user@exemple.com"] # Can't be used when sso_team_id is configured.
# organization_access = {
# read_projects = true or false
# manage_projects = true or false
# read_workspaces = true or false
# manage_workspaces = true or false
# manage_policies = true or false
# manage_policy_overrides = true or false
# manage_run_tasks = true or false
# manage_vcs_settings = true or false
# manage_membership = true or false
# manage_modules = true or false
# manage_providers = true or false
# }
# sso_team_id = ""
# token = true or false
# token_expired_at = ""
# token_force_regenerate = true or false
# visibility = "secret" or "organization"
# }
{
name = "admins"
organization_access = {
manage_projects = true
manage_workspaces = true
manage_policies = true
manage_policy_overrides = true
manage_run_tasks = true
manage_vcs_settings = true
manage_membership = true
manage_modules = true
manage_providers = true
}
sso_team_id = "a2f4919a-4c3c-436a-a010-fde47b98d0fd"
token = true
},
# {
# name = "prisma-cloud"
# organization_access = {
# manage_workspaces = true
# manage_run_tasks = true
# }
# token = true
# },
]
# This local is used to define variable_set at the organization level.
tfc_organization_variable_sets = [
# `tfc_organization_variable_sets` is a list of object.
# Here is an example of an object:
# {
# name = ""
# description = ""
# global = true or false *Cannot be set to true if `workspaces` or ``projects` are defined.*
# projects = [""]
# variables = [
# {
# key = ""
# value = ""
# category = "terraform" or "env"
# sensitive = true or false
# }
# ]
# workspaces = [""]
# }
]
# This local is used to define run tasks that will be applied on every workspace.
tfc_default_run_tasks = [
# `tfc_default_run_tasks` is a list of object.
# Here is an example of an object:
# {
# enforcement_level = "advisory" or "mandatory"
# name = ""
# stage = "pre_plan", "post_plan", or "pre_apply"
# }
# {
# enforcement_level = "mandatory"
# name = "prisma-cloud"
# stage = "post_plan"
# }
]
# This local is used to define all resrouces required to deploy IaC in Terraform Cloud.
projects = {
# `projects` is a map of object where the key is the name of the project.
# Each project can contain all required object like teams, variable sets, workspaces, variables, GitHub, GitHub Teams...
# Refer to "./modules/tfe_workspace/README.md" for more details on the workspace properties.
# Refer to "./modules/tfe_team/README.md" for more details on the permissions type.
# Refer to "./modules/tfe_notification/README.md" for more details on the notification configuration.
# Refer to "./modules/git_repository/README.md" for more details on the GitHub repository configuration.
# Refer to "./modules/git_team/README.md" for more details on the GitHub team configuration.
# Here is an example of an object:
# "project_name" = {
# components = {
# "component_key" = { # This will be use for the Terraform Cloud workspace name and GitHub repository name
# description = "" # This will be use for the Terraform Cloud workspace name and GitHub repository name
# git_actions_secrets = [
# {
# secret_name = ""
# plaintext_value = ""
# }
# ]
# git_repository = {
# topics = [""]
# }
# git_teams = [
# {
# name = ""
# description = ""
# permission = ""
# }
# ]
# tfc_notifications = [
# {
# name = ""
# destination_type = "generic", "email", "email", or "microsoft-teams"
# triggers = ["run:created", "run:planning", "run:needs_attention", "run:applying", "run:completed", "run:errored", "assessment:check_failure", "assessment:drifted", "assessment:failed"]
# url = ""
# }
# ]
# tfc_teams = [
# {
# name = team_name
# workspace_permission = {
# runs = "read", "plan", or "apply"
# variables = "none", "read", or "write"
# state_versions = "none", "read", "read-outputs", or "write"
# sentinel_mocks = "none" or "read"
# workspace_locking = true or false
# run_tasks = true or false
# }
# sso_team_id = ""
# token = true or false
# visibility = "secret" or "organization"
# }
# ]
# tfc_variable_sets = [
# {
# name = ""
# description = ""
# global = false *Cannot be set to true.*
# variables = [
# {
# key = ""
# value = ""
# category = "terraform" or "env"
# sensitive = true or false
# }
# ]
# }
# ]
# tfc_variables = [
# {
# key = ""
# value = ""
# category = "terraform" or "env"
# sensitive = true or false
# }
# ]
# tfc_workspace = {
# agent_pool = ""
# execution_mode = "null", "remote", "local", "agent"
# run_tasks = [
# {
# enforcement_level = "advisory" or "mandatory"
# name = ""
# stage = "pre_plan", "post_plan", or "pre_apply"
# }
# ]
# tag_names = [""]
# trigger_patterns = [""]
# vcs_repo = true or false
# }
# }
# }
# tfc_teams = [
# {
# name = ""
# project_access = "admin", "maintain", "write", "read", "custom"
# custom_project_access = {
# settings = "read", "update", "delete"
# teams = "none", "read", "manage"
# }
# custom_workspace_access = {
# runs = "read", "plan", or "apply"
# sentinel_mocks = "none", or "read"
# state_versions = "none", "read-outputs", "read", or "write"
# variables = "none", "read", or "write"
# create = true or false
# locking = true or false
# delete = true or false
# move = true or false
# run_tasks = true or false
# }
# sso_team_id = ""
# token = true or false
# visibility = "secret" or "organization"
# }
# ]
# tfc_variable_sets = [
# {
# name = ""
# description = ""
# global = false *Cannot be set to true.*
# variables = [
# {
# key = ""
# value = ""
# category = "terraform" or "env"
# sensitive = true or false
# }
# }
# workspaces = [""]
# }
# ]
# }
"Terraform Cloud" = {
factories = {
"TerraformCloud-ModulesRegistry" = {
description = "Repository to provision and manage Terraform Cloud modules registry using Terraform code (IaC)."
git_actions_secrets = [
{
secret_name = "TFC_API_TOKEN"
plaintext_value = "manage-modules"
}
]
git_repository = {
topics = ["foundation", "factory"]
}
git_teams = [
{
name = "TerraformCloud-ModulesRegistry-Owners"
description = "This group grant write access to all files it owns, the ModulesRegistry repository and all Terraform modules repositories."
permission = "push"
},
{
name = "TerraformCloud-ModulesRegistry-Contributors"
description = "This group grant write access to the ModulesRegistry repository and all Terraform modules repositories."
permission = "push"
}
]
tfc_notifications = [
{
name = "microsoft teams"
destination_type = "microsoft-teams"
triggers = ["run:created", "run:planning", "run:needs_attention", "run:applying", "run:completed", "run:errored", "assessment:check_failure", "assessment:drifted", "assessment:failed"]
url = "https://conseilsti.webhook.office.com/webhookb2/b1967add-a0bb-4f55-9508-280cefef4403@0f9829d3-a628-4f2b-a3ac-58e0740d27ae/IncomingWebhook/bd56b2570de84870b0529487428b9ccb/4c88f00c-bcb7-4867-823f-ce6d94fb1c06"
}
]
tfc_teams = [
{
name = "manage-modules"
token = true
organization_access = {
manage_modules = true
}
workspace_permission = {
runs = "apply"
variables = "write"
}
},
{
name = "modules-registry-contributors"
organization_access = {
read_workspaces = true
}
sso_team_id = "a1f6c183-1350-4298-9266-b1ba00c66372"
}
]
tfc_workspace = {
tag_names = ["foundation", "factory"]
trigger_patterns = ["*.tf"]
vcs_repo = true
}
tfc_variables = [
{
key = "TFE_TOKEN"
value = "manage-modules"
category = "env"
sensitive = true
},
{
key = "GITHUB_APP_ID"
value = data.hcp_vault_secrets_secret.this["github-github_app_id"].secret_value
category = "env"
sensitive = true
},
{
key = "GITHUB_APP_INSTALLATION_ID"
value = data.hcp_vault_secrets_secret.this["github-github_app_installation_id"].secret_value
category = "env"
sensitive = true
},
{
key = "GITHUB_APP_PEM_FILE"
value = data.hcp_vault_secrets_secret.this["github-github_app_pem_file"].secret_value
category = "env"
sensitive = true
},
{
key = "GITHUB_OWNER"
value = data.hcp_vault_secrets_secret.this["github-github_owner"].secret_value
category = "env"
sensitive = true
},
{
key = "HCP_CLIENT_ID"
value = data.hcp_vault_secrets_secret.this["hashicorpcloud-hcp_client_id"].secret_value
category = "env"
sensitive = true
},
{
key = "HCP_CLIENT_SECRET"
value = data.hcp_vault_secrets_secret.this["hashicorpcloud-hcp_client_secret"].secret_value
category = "env"
sensitive = true
}
]
}
"TerraformCloud-Policies" = {
description = "Repository to provision and manage Terraform Cloud policies using Terraform code (IaC)."
git_repository = {
topics = ["foundation", "factory"]
}
git_teams = [
{
name = "TerraformCloud-Policies-Contributors"
description = "This group grant write access to the Policies repository."
permission = "push"
}
]
tfc_notifications = [
{
name = "microsoft teams"
destination_type = "microsoft-teams"
triggers = ["run:created", "run:planning", "run:needs_attention", "run:applying", "run:completed", "run:errored", "assessment:check_failure", "assessment:drifted", "assessment:failed"]
url = "https://conseilsti.webhook.office.com/webhookb2/b1967add-a0bb-4f55-9508-280cefef4403@0f9829d3-a628-4f2b-a3ac-58e0740d27ae/IncomingWebhook/bd56b2570de84870b0529487428b9ccb/4c88f00c-bcb7-4867-823f-ce6d94fb1c06"
}
]
tfc_teams = [
{
name = "manage-policies"
token = true
organization_access = {
manage_policies = true
}
workspace_permission = {
runs = "apply"
}
},
{
name = "policies-contributors"
sso_team_id = "045981aa-f630-44c4-88fe-a0b992a2a94e"
organization_access = {
read_workspaces = true
}
}
]
tfc_workspace = {
tag_names = ["foundation", "factory"]
trigger_patterns = ["*.tf", "*.hcl", "*.sentinel"]
vcs_repo = true
}
tfc_variables = [
{
key = "TFE_TOKEN"
value = "manage-policies"
category = "env"
sensitive = true
}
]
}
"TerraformCloud-Projects" = {
description = "Repository to provision and manage Terraform Cloud projects using Terraform code (IaC)."
git_actions_secrets = [
{
secret_name = "TFC_API_TOKEN"
plaintext_value = "admins"
}
]
git_repository = {
topics = ["foundation", "factory"]
}
git_teams = [
{
name = "terraformcloud-projects-contributor"
description = "This group grant write access to the ModulesRegistry repository."
permission = "push"
}
]
tfc_notifications = [
{
name = "microsoft teams"
destination_type = "microsoft-teams"
triggers = ["run:created", "run:planning", "run:needs_attention", "run:applying", "run:completed", "run:errored", "assessment:check_failure", "assessment:drifted", "assessment:failed"]
url = "https://conseilsti.webhook.office.com/webhookb2/b1967add-a0bb-4f55-9508-280cefef4403@0f9829d3-a628-4f2b-a3ac-58e0740d27ae/IncomingWebhook/bd56b2570de84870b0529487428b9ccb/4c88f00c-bcb7-4867-823f-ce6d94fb1c06"
}
]
tfc_workspace = {
tag_names = ["foundation", "factory"]
trigger_patterns = ["*.tf"]
vcs_repo = true
}
tfc_variables = [
{
key = "TFE_TOKEN"
value = "admins"
category = "env"
sensitive = true
}
]
}
}
}
}
}