ingress/terraform/serviceaccount.tf

30 lines
801 B
Terraform
Raw Normal View History

2024-09-20 18:50:34 +00:00
data "authentik_group" "monitoring_publisher" {
name = "monitor.tjo.cloud publisher"
include_users = false
}
resource "authentik_user" "service_account" {
for_each = var.nodes
username = "${each.value.host}.${local.domain}"
name = "${each.value.host}.${local.domain}"
2024-09-20 18:50:34 +00:00
type = "service_account"
path = "ingress.tjo.cloud"
2024-09-20 18:50:34 +00:00
groups = [
data.authentik_group.monitoring_publisher.id,
]
}
resource "authentik_token" "service_account" {
for_each = var.nodes
identifier = replace("service-account-${each.value.host}-${local.domain}", ".", "-")
2024-09-20 19:32:17 +00:00
user = authentik_user.service_account[each.key].id
description = "Service account for ${each.value.host}.${local.domain} node."
2024-09-20 19:32:17 +00:00
expiring = false
intent = "app_password"
retrieve_key = true
2024-09-20 18:50:34 +00:00
}