-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
73 lines (64 loc) · 1.96 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
locals {
team_slugs = { for team in var.teams :
replace(lower(team["name"]), " ", "-") => team
}
team_names = toset([for slug, team in local.team_slugs :
slug if team["id"] == null
])
team_ids = { for slug, team in local.team_slugs :
slug => {
id = team["id"] != null ? team["id"] : data.github_team.this[slug].id
permission = team["permission"]
}
}
labels = { for label in var.issue_labels :
replace(lower(label["name"]), " ", "-") => {
name = label["name"]
color = label["color"]
description = label["description"]
}
}
deploy_keys = { for key in var.deploy_keys :
replace(lower(key["title"]), " ", "-") => {
title = key["title"]
key = key["key"]
read_only = key["read_only"]
}
}
environments = { for name, env in var.environments :
replace(lower(name), " ", "-") => {
name = name
reviewers = env["reviewers"]
branch_policy = env["branch_policy"]
}
}
rendered_environments_secrets = merge([for ename, env in var.environments :
{ for sname, secret in(env["secrets"] != null ? env["secrets"] : {}) :
"${replace(lower(ename), " ", "-")}:${sname}" => merge(secret, {
environment = ename
secret_name = sname
})
}
]...)
# These settings are default for public repository
public_settings = {
secret_scanning = "disabled"
secret_scanning_push_protection = "disabled"
}
rendered_branch_protection = merge(
# Branch protection rules for default branch
var.default_branch_protection_enabled ? {
default = var.default_branch_protection
} : {},
# Additional branch protection rules
var.branch_protection
)
# Combine defaults with input parameters
rendered_webhooks = {
for v in var.webhooks : v["ident"] => {
active = v["active"]
events = v["events"]
configuration = v["configuration"]
}
}
}