-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthentik.tf
97 lines (83 loc) · 2.18 KB
/
authentik.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
resource "kubernetes_namespace" "authentik" {
metadata {
name = "authentik"
annotations = {}
labels = {}
}
}
resource "helm_release" "authentik" {
depends_on = [
helm_release.cert_manager,
helm_release.ingress_nginx,
helm_release.longhorn
]
name = "authentik"
repository = "https://charts.goauthentik.io"
chart = "authentik"
namespace = kubernetes_namespace.authentik.metadata[0].name
set {
name = "postgresql.postgresqlPassword"
value = random_password.authentik_pg_password.result
}
set {
name = "authentik.postgresql.password"
value = random_password.authentik_pg_password.result
}
set {
name = "authentik.secret_key"
value = random_password.authentik_secret_key.result
}
values = [<<EOF
authentik:
error_reporting:
enabled: true
redis:
enabled: true
postgresql:
enabled: true
ingress:
enabled: true
annotations:
external-dns.alpha.kubernetes.io/target: tunnel-origin.${var.domain_name}
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: ${kubectl_manifest.letsencrypt-prod.name}
hosts:
- host: auth.${var.domain_name}
paths:
- path: /
pathType: Prefix
tls:
- hosts:
- git.${var.domain_name}
secretName: gitea.tls
env:
AUTHENTIK_BOOTSTRAP_PASSWORD: ${random_password.bootstrap_password.result}
AUTHENTIK_BOOTSTRAP_TOKEN: ${random_password.authentik_bootstrap_token.result}
EOF
]
}
resource "random_password" "authentik_pg_password" {
length = 32
special = true
}
resource "random_password" "authentik_secret_key" {
length = 50
special = true
}
resource "random_password" "authentik_bootstrap_token" {
length = 128
special = false
}
resource "kubernetes_secret" "authentik_bootstrap" {
metadata {
name = "authentik-bootstrap"
namespace = kubernetes_namespace.authentik.metadata[0].name
}
data = {
authentik_secret_key = random_password.authentik_secret_key.result
authentik_bootstrap_token = random_password.authentik_bootstrap_token.result
bootstrap_password = random_password.bootstrap_password.result
}
type = "Opaque"
}