-
Notifications
You must be signed in to change notification settings - Fork 1
/
users.tf
82 lines (70 loc) · 1.95 KB
/
users.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
locals {
maintainers = {
JAORMX = { role : "admin" }
jhrozek = { role : "member" }
rdimitrov = { role : "admin" }
dmjb = { role : "member" }
evankanderson = { role : "admin" }
eleftherias = { role : "member" }
yrobla = { role : "member" }
lukehinds = { role : "admin" }
blkt = { role : "member" }
puerco = { role : "member" }
Vyom-Yadav = { role : "member" }
teodor-yanev = { role : "member" }
thelinuxfoundation = { role : "admin" }
}
org_members = {
dashtangui = {}
dussab = {}
ethomson = {}
mesembria = {}
staceypotter = {}
}
}
resource "github_membership" "maintainers" {
for_each = local.maintainers
username = each.key
role = each.value.role
}
resource "github_membership" "org_members" {
for_each = local.org_members
username = each.key
role = "member"
}
# Folks who helped with the transition need a manual import
import {
to = github_membership.org_members["dussab"]
id = "mindersec:dussab"
}
import {
to = github_membership.org_members["ethomson"]
id = "mindersec:ethomson"
}
import {
to = github_membership.org_members["staceypotter"]
id = "mindersec:staceypotter"
}
resource "github_team" "maintainers" {
name = "maintainers"
description = "MinderSec maintainers"
// Either "secret" (can't be nested, others can't see it)
// or "closed" (visible within the org)
privacy = "closed"
}
resource "github_team_members" "maintainers" {
team_id = github_team.maintainers.id
dynamic "members" {
for_each = local.maintainers
content {
username = members.key
# Admins will always be listed as "maintainers" by the GitHub API.
role = replace(local.maintainers[members.key].role, "admin", "maintainer")
}
}
}
// Import the team, because it didn't get stored in terraform state.
import {
to = github_team.maintainers
id = "maintainers"
}