This commit is contained in:
2023-10-01 09:45:28 +02:00
parent a374fe5e66
commit f15202de63
13 changed files with 785 additions and 57 deletions

24
share/division/groups.tf Normal file
View File

@@ -0,0 +1,24 @@
locals {
sorted-team-names = reverse(distinct(sort([
for team in var.teams: team.name
])))
sorted-teams = flatten([
for name in local.sorted-team-names: [
for team in var.teams:
team if team.name == name
]
])
}
resource "authentik_group" "division" {
name = "div-${var.instance}"
parent = var.parent
attributes = jsonencode(merge([for app in var.apps: {"${app}" = true}]))
}
resource "authentik_group" "teams" {
count = length(local.sorted-teams)
name = "team-${var.instance}-${local.sorted-teams[count.index].name}"
parent = "div-${var.instance}"
attributes = jsonencode(merge([for app in local.sorted-teams[count.index].apps: {"${app}" = true}]))
}