This repository was archived by the owner on Nov 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,13 @@ resource "azurerm_subnet" "subnet" {
23
23
enforce_private_link_service_network_policies = lookup (var. subnet_enforce_private_link_service_network_policies , var. subnet_names [count . index ], false )
24
24
25
25
dynamic "delegation" {
26
- for_each = lookup (var. subnet_delegation , var_subnet_names[count . index ], {})
27
- name = lookup (delegation. value , " name" )
28
- service_delegation {
29
- name = lookup (delegation. value , " service_name" )
30
- actions = lookup (delegation. value , " service_actions" , [])
26
+ for_each = lookup (var. subnet_delegation , var. subnet_names [count . index ], {})
27
+ content {
28
+ name = delegation. key
29
+ service_delegation {
30
+ name = lookup (delegation. value , " service_name" )
31
+ actions = lookup (delegation. value , " service_actions" , [])
32
+ }
31
33
}
32
34
}
33
35
}
Original file line number Diff line number Diff line change @@ -40,6 +40,19 @@ module "vnet" {
40
40
subnet3 = [" Microsoft.AzureActiveDirectory" ]
41
41
}
42
42
43
+ subnet_delegation = {
44
+ subnet2 = {
45
+ " Microsoft.Sql.managedInstances" = {
46
+ service_name = " Microsoft.Sql/managedInstances"
47
+ service_actions = [
48
+ " Microsoft.Network/virtualNetworks/subnets/join/action" ,
49
+ " Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action" ,
50
+ " Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action" ,
51
+ ]
52
+ }
53
+ }
54
+ }
55
+
43
56
route_tables_ids = {
44
57
subnet1 = azurerm_route_table.rt1.id
45
58
}
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ variable "subnet_enforce_private_link_service_network_policies" {
52
52
default = {}
53
53
}
54
54
55
+ variable "subnet_delegation" {
56
+ description = " A map of subnet name to delegation block on the subnet"
57
+ type = map (map (any ))
58
+ default = {}
59
+ }
60
+
55
61
variable "nsg_ids" {
56
62
description = " A map of subnet name to Network Security Group IDs"
57
63
type = map (string )
You can’t perform that action at this time.
0 commit comments