forked from public/stack
infra/main: add helpful fields to database users list
This commit is contained in:
parent
58f9f507de
commit
b0d3b00b81
|
@ -57,6 +57,17 @@ module "digitalocean_database_cluster" {
|
|||
digitalocean_region = var.region
|
||||
}
|
||||
|
||||
locals {
|
||||
database_host = module.digitalocean_database_cluster.database_cluster.private_host
|
||||
database_port = module.digitalocean_database_cluster.database_cluster.port
|
||||
database_jdbc_uri_prefix = join("", [
|
||||
"jdbc:postgresql://",
|
||||
module.digitalocean_database_cluster.database_cluster.private_host,
|
||||
":",
|
||||
module.digitalocean_database_cluster.database_cluster.port,
|
||||
])
|
||||
}
|
||||
|
||||
# `jq .database_users.value.forgejo | sops --encrypt`
|
||||
output "database_users" {
|
||||
value = {
|
||||
|
@ -70,9 +81,13 @@ output "database_users" {
|
|||
stringData = {
|
||||
name = db_user.name,
|
||||
dbname = db_user.name,
|
||||
host = module.digitalocean_database_cluster.database_cluster.private_host,
|
||||
port = module.digitalocean_database_cluster.database_cluster.port,
|
||||
host = local.database_host,
|
||||
port = local.database_port,
|
||||
password = db_user.password,
|
||||
# Forgejo, they call it "host"
|
||||
address = join(":", [local.database_host, local.database_port]),
|
||||
# Keycloak
|
||||
jdbc_url = "${local.database_jdbc_uri_prefix}/${db_user.name}?sslmode=require",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue