-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
83 lines (64 loc) · 2.07 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
# Local Values
# https://www.terraform.io/language/values/locals
locals {
service_accounts = {
"plt-backstage" = {
github_repositories = ["backstage"]
}
"plt-dd-organization" = {
github_repositories = ["datadog-organization-management"]
}
"plt-gke-info" = {
github_repositories = [
"gke-info-go",
"gke-info-java"
]
}
"plt-gh-organization" = {
github_repositories = ["github-organization-management"]
}
"plt-k8s" = {
github_repositories = ["google-cloud-kubernetes"]
}
"plt-lz-audit" = {
github_repositories = ["google-cloud-audit-logging"]
}
"plt-lz-backend" = {
github_repositories = ["google-cloud-terraform-backend"]
billing_user_group_manager = true
}
"plt-lz-hierarchy" = {
# The service account used to create the folder hierarchy will need to be added
# to the Groups Admins role in the Google Workspace Admin Console.
github_repositories = ["google-cloud-hierarchy"]
}
"plt-lz-identity" = {
github_repositories = ["google-cloud-workload-identity"]
}
"plt-lz-networking" = {
github_repositories = ["google-cloud-networking"]
}
"plt-lz-services" = {
github_repositories = ["google-cloud-services"]
}
"plt-lz-testing" = {
github_repositories = [
"github-terraform-gcp-called-workflows"
]
}
}
# Flatten Function
# https://developer.hashicorp.com/terraform/language/functions/flatten
# flatten ensures that this local value is a flat list of objects, rather
# than a list of lists of objects.
github_repositories = { for service_account in flatten([
# This will iterate over the service_accounts map and return a list of maps
# based of the github_repositories that includes the name key.
for service_account_key, name in local.service_accounts : [
for repository in name.github_repositories : {
name = service_account_key
repository = repository
}
]
]) : service_account.repository => service_account }
}