terraform-modules/postgres/outputs.tf

28 lines
637 B
HCL

# Postgres Instance Output
output "postgres_instance_id" {
value = stackit_postgresflex_instance.this.instance_id
}
locals {
# Build a map: username => db_name
user_to_db = {
for db in var.postgres_databases :
db.user_name => db.db_name
}
}
# Postgres Credential Output
output "postgres_credentials" {
value = {
for k, u in stackit_postgresflex_user.this :
k => {
host = u.host
username = u.username
password = u.password
port = u.port
db_name = stackit_postgresflex_database.this[local.user_to_db[u.username]].name
uri = u.uri
}
}
sensitive = true
}