-
Notifications
You must be signed in to change notification settings - Fork 0
/
teams.tf
27 lines (23 loc) · 930 Bytes
/
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
locals {
prp_team_attachment = var.prp_team == "" ? [] : [{ name = var.prp_team }]
team_attachments = concat(var.additional_teams, local.prp_team_attachment)
}
resource "github_team" "prp" {
count = var.enabled && var.create_team && var.prp_team != "" ? 1 : 0
description = "Team responsible for repository ${local.repository_name}"
name = var.prp_team
}
data "github_team" "prp" {
depends_on = [github_team.prp]
count = var.enabled ? length(local.team_attachments) : 0
slug = lookup(local.team_attachments[count.index], "name")
}
resource "github_team_repository" "prp" {
count = var.enabled ? length(local.team_attachments) : 0
team_id = element(data.github_team.prp.*.id, count.index)
permission = lookup(local.team_attachments[count.index], "permission", "maintain")
repository = local.repository_name
lifecycle {
ignore_changes = [etag, id, team_id]
}
}