-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathlocals.tf
39 lines (36 loc) · 1.95 KB
/
locals.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
# Copyright (c) University College London Hospitals NHS Foundation Trust
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
locals {
naming_suffix = var.suffix_override == "" ? "${var.flowehr_id}-${var.environment}" : var.suffix_override
naming_suffix_truncated = substr(replace(replace(local.naming_suffix, "-", ""), "_", ""), 0, 17)
# Split the /24 (or larger) address space into subnets of required sizes
# for the different terraform modules/required delegations
subnet_address_spaces = cidrsubnets(azurerm_virtual_network.core.address_space[0], 2, 2, 2, 2)
core_shared_address_space = local.subnet_address_spaces[0]
databricks_host_address_space = local.subnet_address_spaces[1]
databricks_container_address_space = local.subnet_address_spaces[2]
serve_webapps_address_space = local.subnet_address_spaces[3]
create_dns_zones = var.private_dns_zones_rg == null
datalake_enabled = try(var.transform.datalake, null) != null
unity_catalog_enabled = try(var.transform.unity_catalog, null) != null
required_private_dns_zones = merge({
blob = "privatelink.blob.core.windows.net"
keyvault = "privatelink.vaultcore.azure.net"
cosmos = "privatelink.documents.azure.com"
databricks = "privatelink.azuredatabricks.net"
sql = "privatelink.database.windows.net"
}, local.datalake_enabled || local.unity_catalog_enabled ? {
dfs = "privatelink.dfs.core.windows.net"
} : {})
}