-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmongo.tf
More file actions
50 lines (42 loc) · 1002 Bytes
/
mongo.tf
File metadata and controls
50 lines (42 loc) · 1002 Bytes
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" "mongo_root_password" {
length = 32
special = false
}
resource "kubernetes_secret" "mongo_password_secret" {
metadata {
name = "mongo-password"
namespace = kubernetes_namespace.gropius.metadata[0].name
}
data = {
password = random_password.mongo_root_password.result
}
}
resource "helm_release" "mongodb" {
name = "mongodb"
repository = "oci://registry-1.docker.io/bitnamicharts"
chart = "mongodb"
namespace = kubernetes_namespace.gropius.metadata[0].name
set {
name = "auth.enabled"
value = "true"
}
set {
name = "auth.rootPassword"
value = random_password.mongo_root_password.result
}
set {
name = "auth.databases[0]"
value = "gropius"
}
set {
name = "auth.usernames[0]"
value = "gropius"
}
dynamic "set" {
for_each = var.storage_class != null ? [var.storage_class] : []
content {
name = "global.storageClass"
value = set.value
}
}
}