generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.tf
54 lines (42 loc) · 2.31 KB
/
main.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
resource "azurerm_resource_group" "this" {
count = var.resource_group_creation_enabled ? 1 : 0
location = var.location
name = var.resource_group_name
tags = var.tags
}
data "azurerm_client_config" "current" {}
module "avm_res_network_privatednszone" {
for_each = local.combined_private_link_private_dns_zones_replaced_with_vnets_to_link
source = "Azure/avm-res-network-privatednszone/azurerm"
version = "0.2.2"
resource_group_name = var.resource_group_creation_enabled ? azurerm_resource_group.this[0].name : var.resource_group_name
domain_name = each.value.zone_value.zone_name
virtual_network_links = each.value.has_vnet ? { for vnet in each.value.vnets : vnet.vnet_key => {
vnetlinkname = "vnet_link-${each.value.zone_key}-${vnet.vnet_key}"
vnetid = vnet.vnet_value.vnet_resource_id
autoregistration = false
tags = var.tags
}
} : {}
tags = var.tags
enable_telemetry = var.enable_telemetry
}
# required AVM resources interfaces
resource "azurerm_management_lock" "this" {
count = var.lock != null ? 1 : 0
lock_level = var.lock.kind
name = coalesce(var.lock.name, "lock-${var.lock.kind}")
scope = local.resource_group_resource_id
notes = var.lock.kind == "CanNotDelete" ? "Cannot delete the resource or its child resources." : "Cannot delete or modify the resource or its child resources."
}
resource "azurerm_role_assignment" "this" {
for_each = var.resource_group_role_assignments
principal_id = each.value.principal_id
scope = local.resource_group_resource_id
condition = each.value.condition
condition_version = each.value.condition_version
delegated_managed_identity_resource_id = each.value.delegated_managed_identity_resource_id
role_definition_id = strcontains(lower(each.value.role_definition_id_or_name), lower(local.role_definition_resource_substring)) ? each.value.role_definition_id_or_name : null
role_definition_name = strcontains(lower(each.value.role_definition_id_or_name), lower(local.role_definition_resource_substring)) ? null : each.value.role_definition_id_or_name
skip_service_principal_aad_check = each.value.skip_service_principal_aad_check
}