-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgithub.tf
84 lines (79 loc) · 2.08 KB
/
github.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
83
84
variable "github_token" {
description = "github token"
}
variable "github_organization" {
description = "github organization"
}
provider "github" {
token = var.github_token
owner = var.github_organization
}
// add all member to github org
resource "github_membership" "member" {
for_each = toset(concat(
local.ictsc2024_members,
local.ictsc2023_members,
local.ictsc2022_members,
local.ictsc2021_members,
local.ictsc2020_members,
local.ictsc2019_members,
local.ictsc2018_members,
local.ictsc9_members,
local.ictsc8_members,
local.ictsc7_members,
local.ictsc6_members,
local.ictsc5_members,
local.ictsc4_members,
))
username = each.value
role = contains(local.admin_members, each.value) ? "admin" : "member"
}
// create team on github
resource "github_team" "team" {
for_each = toset([
"Admins",
"ictsc2024",
"ictsc2023",
"ictsc2022",
"ictsc2021",
"ictsc2020",
"ictsc2019",
"ictsc2018",
"ictsc9",
"ictsc8",
"ictsc7",
"ictsc6",
"ictsc5",
"ictsc4",
])
name = each.value
description = "member of ${each.value}"
privacy = "closed"
}
// add member to team on github
resource "github_team_members" "team_member" {
for_each = {
"Admins" = local.admin_members,
"ictsc2024" = local.ictsc2024_members,
"ictsc2023" = local.ictsc2023_members,
"ictsc2022" = local.ictsc2022_members,
"ictsc2021" = local.ictsc2021_members,
"ictsc2020" = local.ictsc2020_members,
"ictsc2019" = local.ictsc2019_members,
"ictsc2018" = local.ictsc2018_members,
"ictsc9" = local.ictsc9_members,
"ictsc8" = local.ictsc8_members,
"ictsc7" = local.ictsc7_members,
"ictsc6" = local.ictsc6_members,
"ictsc5" = local.ictsc5_members,
"ictsc4" = local.ictsc4_members,
}
team_id = github_team.team[each.key].id
dynamic "members" {
for_each = each.value
content {
username = github_membership.member[members.value].username
role = contains(local.admin_members, members.value) ? "maintainer" : "member"
}
}
}