forked from dodevops/terraform-azure-postgresql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutputs.tf
46 lines (40 loc) · 1.65 KB
/
outputs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
output "server_fqdn" {
description = "FQDN of the database service"
value = local.server_fqdn
}
output "server_id" {
description = "ID of the database server"
value = var.database_flexible ? azurerm_postgresql_flexible_server.server[0].id : azurerm_postgresql_server.server[0].id
}
output "server_name" {
description = "Name of the database server"
value = var.database_flexible ? azurerm_postgresql_flexible_server.server[0].name : azurerm_postgresql_server.server[0].name
}
output "admin_login" {
description = "The administrative username"
value = var.admin_login
}
output "admin_password" {
description = "The password of the administrative user"
value = var.admin_password
}
output "databases" {
description = "Names of the created databases"
value = var.database_flexible ? (
length(azurerm_postgresql_flexible_server_database.db) > 0 ? {
for index, suffix in var.database_suffixes : suffix => azurerm_postgresql_flexible_server_database.db[suffix].name
} : {}) : (
length(azurerm_postgresql_database.db) > 0 ? {
for index, suffix in var.database_suffixes : suffix => azurerm_postgresql_database.db[suffix].name
} : {})
}
output "database_ids" {
description = "IDs of the created databases"
value = var.database_flexible ? (
length(azurerm_postgresql_flexible_server_database.db) > 0 ? {
for index, suffix in var.database_suffixes : suffix => azurerm_postgresql_flexible_server_database.db[suffix].id
} : {}) : (
length(azurerm_postgresql_database.db) > 0 ? {
for index, suffix in var.database_suffixes : suffix => azurerm_postgresql_database.db[suffix].id
} : {})
}