generated from Azure/terraform-verified-module
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnaming.tf
54 lines (48 loc) · 2.35 KB
/
naming.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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
data "azurenoopsutils_resource_name" "primary_sql" {
name = var.workload_name
resource_type = "azurerm_mssql_server"
prefixes = [var.org_name, module.mod_azure_region_lookup.location_short]
suffixes = compact([var.name_prefix == "" ? null : local.name_prefix, var.deploy_environment, local.name_suffix, "primary", var.use_naming ? "" : "sqlsvr"])
use_slug = var.use_naming
clean_input = true
separator = "-"
}
data "azurenoopsutils_resource_name" "secondary_sql" {
name = var.workload_name
resource_type = "azurerm_mssql_server"
prefixes = [var.org_name, module.mod_azure_region_lookup.location_short]
suffixes = compact([var.name_prefix == "" ? null : local.name_prefix, var.deploy_environment, local.name_suffix, "secondary", var.use_naming ? "" : "sqlsvr"])
use_slug = var.use_naming
clean_input = true
separator = "-"
}
data "azurenoopsutils_resource_name" "sql_pool" {
name = var.workload_name
resource_type = "azurerm_mssql_elasticpool"
prefixes = [var.org_name, module.mod_azure_region_lookup.location_short]
suffixes = compact([var.name_prefix == "" ? null : local.name_prefix, var.deploy_environment, local.name_suffix, var.use_naming ? "" : "sqlpool"])
use_slug = var.use_naming
clean_input = true
separator = "-"
}
data "azurenoopsutils_resource_name" "sql_dbs" {
for_each = try({ for database in var.databases : database.name => database }, {})
name = var.workload_name
resource_type = "azurerm_mssql_database"
prefixes = [var.org_name, module.mod_azure_region_lookup.location_short]
suffixes = compact([var.name_prefix == "" ? null : local.name_prefix, var.deploy_environment, local.name_suffix, var.use_naming ? "" : "sqldb"])
use_slug = var.use_naming
clean_input = true
separator = "-"
}
data "azurenoopsutils_resource_name" "sql_storage" {
name = var.workload_name
resource_type = "azurerm_storage_account"
prefixes = [var.org_name, module.mod_azure_region_lookup.location_short]
suffixes = compact([var.name_prefix == "" ? null : local.name_prefix, var.deploy_environment, local.name_suffix, var.use_naming ? "" : "st"])
use_slug = var.use_naming
clean_input = true
separator = "-"
}