github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/subnet.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_subnet"
     4  sidebar_current: "docs-aws-resource-subnet"
     5  description: |-
     6    Provides an VPC subnet resource.
     7  ---
     8  
     9  # aws\_subnet
    10  
    11  Provides an VPC subnet resource.
    12  
    13  ## Example Usage
    14  
    15  ```hcl
    16  resource "aws_subnet" "main" {
    17    vpc_id     = "${aws_vpc.main.id}"
    18    cidr_block = "10.0.1.0/24"
    19  
    20    tags {
    21      Name = "Main"
    22    }
    23  }
    24  ```
    25  
    26  ## Argument Reference
    27  
    28  The following arguments are supported:
    29  
    30  * `availability_zone`- (Optional) The AZ for the subnet.
    31  * `cidr_block` - (Required) The CIDR block for the subnet.
    32  * `ipv6_cidr_block` - (Optional) The IPv6 network range for the subnet,
    33      in CIDR notation. The subnet size must use a /64 prefix length.
    34  * `map_public_ip_on_launch` -  (Optional) Specify true to indicate
    35      that instances launched into the subnet should be assigned
    36      a public IP address. Default is `false`.
    37  * `assign_ipv6_address_on_creation` - (Optional) Specify true to indicate
    38      that network interfaces created in the specified subnet should be
    39      assigned an IPv6 address. Default is `false`
    40  * `vpc_id` - (Required) The VPC ID.
    41  * `tags` - (Optional) A mapping of tags to assign to the resource.
    42  
    43  ## Attributes Reference
    44  
    45  The following attributes are exported:
    46  
    47  * `id` - The ID of the subnet
    48  * `availability_zone`- The AZ for the subnet.
    49  * `cidr_block` - The CIDR block for the subnet.
    50  * `vpc_id` - The VPC ID.
    51  * `ipv6_association_id` - The association ID for the IPv6 CIDR block.
    52  * `ipv6_cidr_block` - The IPv6 CIDR block.
    53  
    54  ## Import
    55  
    56  Subnets can be imported using the `subnet id`, e.g.
    57  
    58  ```
    59  $ terraform import aws_subnet.public_subnet subnet-9d4a7b6c
    60  ```