devops/quadlets/modules/postgres/main.tf

48 lines
901 B
HCL

variable "wait_on" {
type = any
description = "Resources to wait on"
default = true
}
variable "server_ip" {
type = string
}
variable "ssh_private_key_path" {
type = string
}
resource "random_password" "password" {
length = 32
special = false
}
module "postgres" {
source = "../quadlet-app"
wait_on = var.wait_on
server_ip = var.server_ip
ssh_private_key_path = var.ssh_private_key_path
app_name = "postgres"
image = "docker.io/postgres:17"
ports = ["5432:5432"]
volumes = ["/opt/storage/data/postgres:/var/lib/postgresql/data:Z"]
environment = {
POSTGRES_PASSWORD = random_password.password.result
}
}
output "app_urls" {
value = module.postgres.app_urls
}
output "installed" {
value = true
depends_on = [module.postgres.installed]
}
output "password" {
value = random_password.password.result
sensitive = true
}