fix
This commit is contained in:
24
share/division/groups.tf
Normal file
24
share/division/groups.tf
Normal 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}]))
|
||||
}
|
||||
Reference in New Issue
Block a user