-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
locals.tf
79 lines (66 loc) · 3.09 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
# Local Values
# https://www.terraform.io/language/values/locals
locals {
admins = {
for user in var.admins : user => "admin"
}
branch_protections = {
for repository_key, repository in var.repositories : repository_key => repository if repository.enable_branch_protection
}
child_team_repositories = {
for repository in flatten([
for team_child_key, team_child in var.team_children : [
for repository in team_child.repositories : {
team_child = team_child_key
repository = repository
permission = team_child.permission
}
]
]) : "${repository.team_child}-${repository.repository}" => repository }
datadog_webhooks = {
for repository_key, repository in var.repositories : repository_key => repository if repository.enable_datadog_webhook
}
discord_webhooks = {
for repository_key, repository in var.repositories : repository_key => repository if repository.enable_discord_webhook
}
members = {
for user in var.members : user => "member"
}
parent_team_repositories = {
for repository in flatten([
for team_parent_key, team_parent in var.team_parents : [
for repository in team_parent.repositories : {
team_parent = team_parent_key
repository = repository
permission = team_parent.permission
}
]
]) : "${repository.team_parent}-${repository.repository}" => repository }
repository_default_labels = {
"bug" = { color = "84A255", description = "Something is not working" }
"chore" = { color = "FBCA04", description = "Grunt tasks etc; no production code change" }
"documentation" = { color = "0075CA", description = "Improvements or additions to documentation" }
"enhancement" = { color = "A2EEEF", description = "New feature or request" }
"good first issue" = { color = "7057FF", description = "Good for newcomers" }
"major" = { color = "B60205", description = "Major version: Incompatible changes" }
"minor" = { color = "FBCA04", description = "Minor version: Additional functionality in a backwards-compatible manner" }
"patch" = { color = "0E8A16", description = "Patch version: Backwards-compatible bug fixes" }
"security" = { color = "B60205", description = "Security vulnerability or configuration" }
"tech-debt" = { color = "443221", description = "Accrued work that is owed to a system or process" }
}
repository_labels = {
for label in flatten([
for repository_key, repository in var.repositories : [
for label_key, label in merge(local.repository_default_labels, repository.labels) : {
name = label_key
color = label.color
description = label.description
repository = repository_key
}
]
]) : "${label.repository}-${label.name}" => label }
review_request_delegations = {
for team_parent_key, team_parent in var.team_parents : team_parent_key => team_parent if team_parent.review_request_delegation
}
users = merge(local.admins, local.members)
}