-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
53 lines (42 loc) · 1.43 KB
/
main.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
###################################################
# GitHub Organization Team
###################################################
resource "github_team" "this" {
name = var.name
description = var.description
privacy = var.is_secret ? "secret" : "closed"
parent_team_id = var.parent_id
create_default_maintainer = var.default_maintainer_enabled
ldap_dn = var.ldap_group_dn
}
###################################################
# Identity Provider Groups for GitHub Organization Team Sync
###################################################
data "github_organization_team_sync_groups" "this" {
count = var.identity_provider_team_sync.enabled ? 1 : 0
}
locals {
idp_groups = (var.identity_provider_team_sync.enabled
? {
for group in data.github_organization_team_sync_groups.this[0].groups :
group.group_name => {
id = group.group_id
name = group.group_name
description = group.group_description
}
}
: {}
)
}
resource "github_team_sync_group_mapping" "this" {
count = var.identity_provider_team_sync.enabled ? 1 : 0
team_slug = github_team.this.slug
dynamic "group" {
for_each = var.identity_provider_team_sync.groups
content {
group_id = local.idp_groups[group.value].id
group_name = local.idp_groups[group.value].name
group_description = local.idp_groups[group.value].description
}
}
}