github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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  ```hcl
    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 subnet. 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.
    62  * `name` - The name of the subnet.
    63  * `resource_group_name` - The name of the resource group in which the subnet is created in.
    64  * `virtual_network_name` - The name of the virtual network in which the subnet is created in
    65  * `address_prefix` - The address prefix for the subnet
    66  
    67  ## Import
    68  
    69  Subnets can be imported using the `resource id`, e.g.
    70  
    71  ```
    72  terraform import azurerm_subnet.testSubnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1
    73  ```