2014-07-23 22:32:33 +02:00
|
|
|
---
|
|
|
|
layout: "aws"
|
|
|
|
page_title: "AWS: aws_subnet"
|
|
|
|
sidebar_current: "docs-aws-resource-subnet"
|
|
|
|
---
|
|
|
|
|
|
|
|
# aws\_subnet
|
|
|
|
|
|
|
|
Provides an VPC subnet resource.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
|
|
|
```
|
2014-07-23 22:38:12 +02:00
|
|
|
resource "aws_subnet" "main" {
|
2014-07-23 22:32:33 +02:00
|
|
|
vpc_id = "${aws_vpc.main.id}"
|
2014-08-19 21:49:30 +02:00
|
|
|
cidr_block = "10.0.1.0/24"
|
2014-07-23 22:32:33 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `availability_zone`- (Optional) The AZ for the subnet.
|
|
|
|
* `cidr_block` - (Required) The CIDR block for the subnet.
|
2014-09-16 16:37:22 +02:00
|
|
|
* `map_public_ip_on_launch` - (Optional) Specify true to indicate
|
|
|
|
that instances launched into the subnet should be assigned
|
|
|
|
a public IP address.
|
2014-07-23 22:32:33 +02:00
|
|
|
* `vpc_id` - (Required) The VPC ID.
|
|
|
|
|
|
|
|
## 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.
|
|
|
|
|