-
Notifications
You must be signed in to change notification settings - Fork 1
/
teams.tf
48 lines (41 loc) · 1.22 KB
/
teams.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
#######################
# Organization Owners #
#######################
resource "github_membership" "org-owner_the-maldridge" {
username = "the-maldridge"
role = "admin"
}
######################
# GitHub Memberships #
######################
locals {
github_teams = {
core-dev = {
description = "Developers of the entire ecosystem"
maintainers = [
"the-maldridge",
]
}
python-dev = {
description = "Developers of the python library"
members = [
"classabbyamp",
]
}
}
}
resource "github_team" "teams" {
for_each = local.github_teams
name = each.key
description = each.value.description
privacy = "closed"
}
resource "github_team_membership" "team_membership" {
for_each = { for i in flatten([for team_name, team in local.github_teams : [
[for username in lookup(team, "maintainers", []) : { team_name = team_name, role = "maintainer", username = username }],
[for username in lookup(team, "members", []) : { team_name = team_name, role = "member", username = username }],
]]) : "${i.team_name}_${i.username}" => i }
team_id = github_team.teams[each.value.team_name].id
role = each.value.role
username = each.value.username
}