[POSTGRES] Add to cluster.

This commit is contained in:
Kat Inskip 2023-05-01 12:06:22 -07:00
parent 7c3e6a961e
commit c39682178d
Signed by: kat
GPG key ID: 465E64DECEA8CF0F

39
cluster/postgres.tf Normal file
View file

@ -0,0 +1,39 @@
variable "postgres_password" {
type = string
}
resource "kubernetes_secret" "postgres_auth_secret" {
metadata {
name = "postgres-auth-secret"
namespace = "postgresql"
}
data = {
postgresPassword = var.postgres_password
}
type = "Opaque"
}
resource "helm_release" "postgresql" {
name = "postgresql"
repository = "https://charts.bitnami.com/bitnami"
chart = "postgresql"
create_namespace = true
namespace = "postgresql"
timeout = var.helm_timeout
cleanup_on_fail = true
force_update = true
values = [
yamlencode({
global = {
postgresql = {
auth = {
existingSecret = "postgres-auth-secret"
}
}
}
})
]
}