github.com/adrian-bl/terraform@v0.7.0-rc2.0.20160705220747-de0a34fc3517/website/source/docs/providers/azurerm/r/subnet.html.markdown (about) 1 --- 2 layout: "azurerm" 3 page_title: "Azure Resource Manager: azure_subnet" 4 sidebar_current: "docs-azurerm-resource-network-subnet" 5 description: |- 6 Creates a new subnet. Subnets represent network segments within the IP space defined by the virtual network. 7 --- 8 9 # azurerm\_subnet 10 11 Creates a new subnet. Subnets represent network segments within the IP space defined by the virtual network. 12 13 ## Example Usage 14 15 ``` 16 resource "azurerm_resource_group" "test" { 17 name = "acceptanceTestResourceGroup1" 18 location = "West US" 19 } 20 21 resource "azurerm_virtual_network" "test" { 22 name = "acceptanceTestVirtualNetwork1" 23 address_space = ["10.0.0.0/16"] 24 location = "West US" 25 resource_group_name = "${azurerm_resource_group.test.name}" 26 } 27 28 resource "azurerm_subnet" "test" { 29 name = "testsubnet" 30 resource_group_name = "${azurerm_resource_group.test.name}" 31 virtual_network_name = "${azurerm_virtual_network.test.name}" 32 address_prefix = "10.0.1.0/24" 33 } 34 ``` 35 36 ## Argument Reference 37 38 The following arguments are supported: 39 40 * `name` - (Required) The name of the virtual network. Changing this forces a 41 new resource to be created. 42 43 * `resource_group_name` - (Required) The name of the resource group in which to 44 create the subnet. 45 46 * `virtual_network_name` - (Required) The name of the virtual network to which to attach the subnet. 47 48 * `address_prefix` - (Required) The address prefix to use for the subnet. 49 50 * `network_security_group_id` - (Optional) The ID of the Network Security Group to associate with 51 the subnet. 52 53 * `route_table_id` - (Optional) The ID of the Route Table to associate with 54 the subnet. 55 56 ## Attributes Reference 57 58 The following attributes are exported: 59 60 * `id` - The subnet ID. 61 * `ip_configurations` - The collection of IP Configurations with IPs within this subnet.