fix
This commit is contained in:
@@ -1,50 +1,72 @@
|
|||||||
|
resource "random_password" "srs" {
|
||||||
|
length = 32
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "zonemta" {
|
||||||
|
length = 32
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "webmail" {
|
||||||
|
length = 32
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "totp" {
|
||||||
|
length = 32
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "access" {
|
||||||
|
length = 32
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "authentik" {
|
||||||
|
length = 32
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "default" {
|
||||||
|
length = 8
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "scim-seed" {
|
||||||
|
length = 16
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
secrets = {
|
||||||
|
srs = random_password.srs.result
|
||||||
|
zonemta = random_password.zonemta.result
|
||||||
|
webmail = random_password.webmail.result
|
||||||
|
totp = random_password.totp.result
|
||||||
|
dkim = random_password.dkim.result
|
||||||
|
access = random_password.access.result
|
||||||
|
authentik = random_password.authentik.result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resource "kubectl_manifest" "wildduck_secret" {
|
resource "kubectl_manifest" "wildduck_secret" {
|
||||||
ignore_fields = ["metadata.annotations"]
|
|
||||||
yaml_body = <<-EOF
|
yaml_body = <<-EOF
|
||||||
apiVersion: "secretgenerator.mittwald.de/v1alpha1"
|
apiVersion: v1
|
||||||
kind: "StringSecret"
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
name: "${var.instance}"
|
name: "${var.instance}"
|
||||||
namespace: "${var.namespace}"
|
namespace: "${var.namespace}"
|
||||||
labels: ${jsonencode(local.common_labels)}
|
labels: ${jsonencode(local.common_labels)}
|
||||||
spec:
|
stringData:
|
||||||
forceRegenerate: false
|
srs: "${local.srs}"
|
||||||
fields:
|
zonemta: "${local.zonemta}"
|
||||||
- fieldName: "srs"
|
webmail: "${local.webmail}"
|
||||||
length: "32"
|
totp: "${local.totp}"
|
||||||
- fieldName: "zonemta"
|
dkim: "${local.dkim}"
|
||||||
length: "32"
|
access: "${local.access}"
|
||||||
- fieldName: "webmail"
|
authentik: "${local.authentik}"
|
||||||
length: "32"
|
default: "${random_password.default.result}"
|
||||||
- fieldName: "totp"
|
scim-seed: "${random_password.scim-seed.result}"
|
||||||
length: "32"
|
EOF
|
||||||
- fieldName: "dkim"
|
|
||||||
length: "32"
|
|
||||||
- fieldName: "access"
|
|
||||||
length: "32"
|
|
||||||
- fieldName: "authentik" # Bearer for authentik to wildduck-scim
|
|
||||||
length: "32"
|
|
||||||
- fieldName: "default" # Default user password
|
|
||||||
length: "8"
|
|
||||||
- fieldName: "scim-seed"
|
|
||||||
length: "16"
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
data "kubernetes_secret_v1" "wildduck" {
|
|
||||||
depends_on = [ kubectl_manifest.wildduck_secret ]
|
|
||||||
metadata {
|
|
||||||
name = var.instance
|
|
||||||
namespace = var.namespace
|
|
||||||
}
|
|
||||||
}
|
|
||||||
locals {
|
|
||||||
secrets = {
|
|
||||||
srs = data.kubernetes_secret_v1.wildduck.data["srs"]
|
|
||||||
zonemta = data.kubernetes_secret_v1.wildduck.data["zonemta"]
|
|
||||||
webmail = data.kubernetes_secret_v1.wildduck.data["webmail"]
|
|
||||||
totp = data.kubernetes_secret_v1.wildduck.data["totp"]
|
|
||||||
dkim = data.kubernetes_secret_v1.wildduck.data["dkim"]
|
|
||||||
access = data.kubernetes_secret_v1.wildduck.data["access"]
|
|
||||||
authentik = data.kubernetes_secret_v1.wildduck.data["authentik"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user