feature/mapping-psql-dbname #10

Merged
florian.heuer merged 2 commits from feature/mapping-psql-dbname into main 2025-12-18 15:17:43 +00:00
Showing only changes of commit 010ac595c1 - Show all commits

View file

@ -3,6 +3,14 @@ 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 = {
@ -12,9 +20,9 @@ output "postgres_credentials" {
username = u.username
password = u.password
port = u.port
db_name = stackit_postgresflex_database.this[u.username].name
db_name = stackit_postgresflex_database.this[local.user_to_db[u.username]].name
uri = u.uri
}
}
sensitive = true
}
}