-
Notifications
You must be signed in to change notification settings - Fork 12
/
outputs.tf
99 lines (86 loc) · 3.49 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
output "sql_administrator_login" {
description = "SQL Administrator login"
value = var.administrator_login
sensitive = true
}
output "sql_administrator_password" {
description = "SQL Administrator password"
value = var.administrator_password
sensitive = true
}
output "sql_server" {
description = "SQL Server"
value = azurerm_mssql_server.sql
}
output "sql_elastic_pool" {
description = "SQL Elastic Pool"
value = try(azurerm_mssql_elasticpool.elastic_pool[0], null)
}
output "sql_databases" {
description = "SQL Databases"
value = var.elastic_pool_enabled ? azurerm_mssql_database.elastic_pool_database : azurerm_mssql_database.single_database
}
output "sql_elastic_pool_id" {
description = "ID of the SQL Elastic Pool"
value = var.elastic_pool_enabled ? azurerm_mssql_elasticpool.elastic_pool[0].id : null
}
output "sql_databases_id" {
description = "Map of the SQL Databases IDs"
value = var.elastic_pool_enabled ? { for db in azurerm_mssql_database.elastic_pool_database : db.name => db.id } : { for db in azurerm_mssql_database.single_database : db.name => db.id }
}
output "default_administrator_databases_connection_strings" {
description = "Map of the SQL Databases with administrator credentials connection strings"
value = var.elastic_pool_enabled ? {
for db in azurerm_mssql_database.elastic_pool_database : db.name => formatlist(
"Server=tcp:%s;Database=%s;User ID=%s;Password=%s;Encrypt=true;",
azurerm_mssql_server.sql.fully_qualified_domain_name,
db.name,
var.administrator_login,
var.administrator_password
)
} : {
for db in azurerm_mssql_database.single_database : db.name => formatlist(
"Server=tcp:%s;Database=%s;User ID=%s;Password=%s;Encrypt=true;",
azurerm_mssql_server.sql.fully_qualified_domain_name,
db.name,
var.administrator_login,
var.administrator_password
)
}
sensitive = true
}
output "default_databases_users" {
description = "Map of the SQL Databases dedicated users"
value = {
for db_user in local.databases_users :
db_user.database => { "user_name" = db_user.username, "password" = module.databases_users[format("%s-%s", db_user.username, db_user.database)].database_user_password }
}
sensitive = true
}
output "custom_databases_users" {
description = "Map of the custom SQL Databases users"
value = {
for custom_user in var.custom_users :
custom_user.database => { "user_name" = custom_user.name, "password" = module.custom_users[format("%s-%s", custom_user.name, custom_user.database)].database_user_password }...
}
sensitive = true
}
output "custom_databases_users_roles" {
description = "Map of the custom SQL Databases users roles"
value = {
for custom_user in var.custom_users :
join("-", [custom_user.name, custom_user.database]) => module.custom_users[join("-", [custom_user.name, custom_user.database])].database_user_roles
}
}
output "identity" {
description = "Identity block with principal ID and tenant ID used for this SQL Server"
value = try(azurerm_mssql_server.sql.identity[0], null)
}
output "security_alert_policy_id" {
description = "ID of the MS SQL Server Security Alert Policy"
value = try(azurerm_mssql_server_security_alert_policy.sql_server["enabled"].id, null)
}
output "vulnerability_assessment_id" {
description = "ID of the MS SQL Server Vulnerability Assessment"
value = try(azurerm_mssql_server_vulnerability_assessment.sql_server["enabled"].id, null)
}