Files
opentf/website/source/docs/providers/aws/r/subnet.html.markdown
Paul Stack 72a14ef2bb provider/aws: Add IPv6 outputs to aws_subnet datasource (#13841)
Fixes: #13595

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccDataSourceAwsSubnet'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/21 13:52:43 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccDataSourceAwsSubnet -timeout 120m
=== RUN   TestAccDataSourceAwsSubnetIDs
--- PASS: TestAccDataSourceAwsSubnetIDs (81.05s)
=== RUN   TestAccDataSourceAwsSubnet
--- PASS: TestAccDataSourceAwsSubnet (57.48s)
=== RUN   TestAccDataSourceAwsSubnetIpv6ByIpv6Filter
--- PASS: TestAccDataSourceAwsSubnetIpv6ByIpv6Filter (82.63s)
=== RUN   TestAccDataSourceAwsSubnetIpv6ByIpv6CidrBlock
--- PASS: TestAccDataSourceAwsSubnetIpv6ByIpv6CidrBlock (82.43s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	303.625s
```
2017-04-21 16:54:55 +03:00

60 lines
1.6 KiB
Markdown

---
layout: "aws"
page_title: "AWS: aws_subnet"
sidebar_current: "docs-aws-resource-subnet"
description: |-
Provides an VPC subnet resource.
---
# aws\_subnet
Provides an VPC subnet resource.
## Example Usage
```hcl
resource "aws_subnet" "main" {
vpc_id = "${aws_vpc.main.id}"
cidr_block = "10.0.1.0/24"
tags {
Name = "Main"
}
}
```
## Argument Reference
The following arguments are supported:
* `availability_zone`- (Optional) The AZ for the subnet.
* `cidr_block` - (Required) The CIDR block for the subnet.
* `ipv6_cidr_block` - (Optional) The IPv6 network range for the subnet,
in CIDR notation. The subnet size must use a /64 prefix length.
* `map_public_ip_on_launch` - (Optional) Specify true to indicate
that instances launched into the subnet should be assigned
a public IP address. Default is `false`.
* `assign_ipv6_address_on_creation` - (Optional) Specify true to indicate
that network interfaces created in the specified subnet should be
assigned an IPv6 address. Default is `false`
* `vpc_id` - (Required) The VPC ID.
* `tags` - (Optional) A mapping of tags to assign to the resource.
## Attributes Reference
The following attributes are exported:
* `id` - The ID of the subnet
* `availability_zone`- The AZ for the subnet.
* `cidr_block` - The CIDR block for the subnet.
* `vpc_id` - The VPC ID.
* `ipv6_association_id` - The association ID for the IPv6 CIDR block.
* `ipv6_cidr_block` - The IPv6 CIDR block.
## Import
Subnets can be imported using the `subnet id`, e.g.
```
$ terraform import aws_subnet.public_subnet subnet-9d4a7b6c
```