-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteam.tf
More file actions
50 lines (46 loc) · 1.58 KB
/
team.tf
File metadata and controls
50 lines (46 loc) · 1.58 KB
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
locals {
teams = [
{
name : "CI",
description : "Continuous Integration",
privacy : "secret",
},
{
name : "Infra",
description : "Team of Cloud and Platform Engineers",
},
{
name : "Eng",
description : "Team of Development Engineers",
}
]
each_teams = {
for team in local.teams : replace(lower(team.name), " ", "-") => {
name : team.name,
description : team.description,
privacy : can(team.privacy) ? team.privacy : "closed",
parent_team_id : can(team.parent_team_id) ? team.parent_team_id : null,
create_default_maintainer : can(team.create_default_maintainer) ? team.create_default_maintainer : false
}
}
}
resource "github_team" "team" {
for_each = local.each_teams
name = each.value.name
description = each.value.description
privacy = each.value.privacy
parent_team_id = each.value.parent_team_id
create_default_maintainer = each.value.create_default_maintainer
}
resource "github_team_repository" "eng_repos" {
count = length(data.terraform_remote_state.repos.outputs.repo_names)
team_id = github_team.team["eng"].slug
repository = data.terraform_remote_state.repos.outputs.repo_names[count.index]
permission = "push"
}
resource "github_team_repository" "ci_repos" {
count = length(data.terraform_remote_state.repos.outputs.repo_names)
team_id = github_team.team["ci"].slug
repository = data.terraform_remote_state.repos.outputs.repo_names[count.index]
permission = "admin"
}