-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostgres.tf
50 lines (42 loc) · 1.05 KB
/
postgres.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
resource "random_password" "postgres_password" {
length = 32
special = false
}
resource "kubernetes_secret" "postgres_password_secret" {
metadata {
name = "postgres-password"
namespace = kubernetes_namespace.gropius.metadata[0].name
}
data = {
password = random_password.postgres_password.result
}
}
resource "helm_release" "postgres_db" {
name = "postgres-db"
repository = "oci://registry-1.docker.io/bitnamicharts"
chart = "postgresql"
namespace = kubernetes_namespace.gropius.metadata[0].name
set {
name = "global.postgresql.auth.database"
value = "gropius"
}
dynamic "set" {
for_each = var.storage_class != null ? [var.storage_class] : []
content {
name = "global.storageClass"
value = set.value
}
}
set {
name = "postgres.auth.enablePostgresUser"
value = "false"
}
set {
name = "global.postgresql.auth.username"
value = "postgres"
}
set {
name = "global.postgresql.auth.password"
value = random_password.postgres_password.result
}
}