-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteams.tf
More file actions
24 lines (22 loc) · 975 Bytes
/
teams.tf
File metadata and controls
24 lines (22 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ---------------------------------------------------------------------------------------------------------------------
# Computations
# ---------------------------------------------------------------------------------------------------------------------
locals {
teams_to_create = merge([for permission, teams in var.team_permissions :
{ for team in teams :
format("%s_%s", team, permission) => {
team = team
permission = permission
}
} if try(length(teams), 0) > 0
]...)
}
# ---------------------------------------------------------------------------------------------------------------------
# Resources
# ---------------------------------------------------------------------------------------------------------------------
resource "github_team_repository" "permissions" {
for_each = local.teams_to_create
repository = local.repo.name
team_id = var.teams[each.value.team].id
permission = each.value.permission
}