forked from Azure/terraform-azurerm-vnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
23 lines (21 loc) · 929 Bytes
/
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
#Azure Generic vNet Module
resource "azurerm_resource_group" "vnet" {
name = "${var.resource_group_name}"
location = "${var.location}"
}
resource "azurerm_virtual_network" "vnet" {
name = "${var.vnet_name}"
location = "${var.location}"
address_space = ["${var.address_space}"]
resource_group_name = "${azurerm_resource_group.vnet.name}"
dns_servers = "${var.dns_servers}"
tags = "${var.tags}"
}
resource "azurerm_subnet" "subnet" {
name = "${var.subnet_names[count.index]}"
virtual_network_name = "${azurerm_virtual_network.vnet.name}"
resource_group_name = "${azurerm_resource_group.vnet.name}"
address_prefix = "${var.subnet_prefixes[count.index]}"
network_security_group_id = "${lookup(var.nsg_ids,var.subnet_names[count.index],"")}"
count = "${length(var.subnet_names)}"
}