-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
executable file
·31 lines (26 loc) · 1.01 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
resource "azurerm_virtual_network" "vnet" {
name = var.vnet_name
resource_group_name = var.resource_group_name
location = var.location
address_space = var.vnet_address_prefixes
dns_servers = var.inbound_ip_address != null ? [var.inbound_ip_address] : null
tags = merge(var.tags, { "service" = "networking" })
}
resource "azurerm_subnet" "snet" {
for_each = { for s in var.subnets : s.name => s }
name = each.value.name
resource_group_name = var.resource_group_name
virtual_network_name = azurerm_virtual_network.vnet.name
service_endpoints = each.value.service_endpoints
address_prefixes = each.value.address_prefixes
dynamic "delegation" {
for_each = each.value.delegation != null ? [each.value.delegation] : []
content {
name = delegation.value.name
service_delegation {
name = delegation.value.service_delegation.name
actions = delegation.value.service_delegation.actions
}
}
}
}