2014-07-23 22:32:33 +02:00
|
|
|
---
|
|
|
|
layout: "aws"
|
|
|
|
page_title: "AWS: aws_vpc"
|
|
|
|
sidebar_current: "docs-aws-resource-vpc"
|
2014-10-22 05:21:56 +02:00
|
|
|
description: |-
|
|
|
|
Provides an VPC resource.
|
2014-07-23 22:32:33 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
# aws\_vpc
|
|
|
|
|
|
|
|
Provides an VPC resource.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2014-10-09 08:46:36 +02:00
|
|
|
Basic usage:
|
|
|
|
|
2014-07-23 22:32:33 +02:00
|
|
|
```
|
|
|
|
resource "aws_vpc" "main" {
|
2017-02-18 23:48:50 +01:00
|
|
|
cidr_block = "10.0.0.0/16"
|
2014-07-23 22:32:33 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2014-10-09 08:46:36 +02:00
|
|
|
Basic usage with tags:
|
|
|
|
|
|
|
|
```
|
|
|
|
resource "aws_vpc" "main" {
|
2017-02-18 23:48:50 +01:00
|
|
|
cidr_block = "10.0.0.0/16"
|
|
|
|
instance_tenancy = "dedicated"
|
2014-10-09 08:46:36 +02:00
|
|
|
|
2017-02-18 23:48:50 +01:00
|
|
|
tags {
|
|
|
|
Name = "main"
|
|
|
|
}
|
2014-10-09 08:46:36 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2014-07-23 22:32:33 +02:00
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `cidr_block` - (Required) The CIDR block for the VPC.
|
2014-12-10 11:39:14 +01:00
|
|
|
* `instance_tenancy` - (Optional) A tenancy option for instances launched into the VPC
|
2014-08-09 14:43:00 +02:00
|
|
|
* `enable_dns_support` - (Optional) A boolean flag to enable/disable DNS support in the VPC. Defaults true.
|
|
|
|
* `enable_dns_hostnames` - (Optional) A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
|
2017-02-18 23:48:50 +01:00
|
|
|
* `enable_classiclink` - (Optional) A boolean flag to enable/disable ClassicLink
|
2016-01-28 16:54:58 +01:00
|
|
|
for the VPC. Only valid in regions and accounts that support EC2 Classic.
|
|
|
|
See the [ClassicLink documentation][1] for more information. Defaults false.
|
2017-03-01 17:16:59 +01:00
|
|
|
* `assign_generated_ipv6_cidr_block` - (Optional) Requests an Amazon-provided IPv6 CIDR
|
|
|
|
block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or
|
|
|
|
the size of the CIDR block. Default is `false`.
|
2014-10-09 08:46:36 +02:00
|
|
|
* `tags` - (Optional) A mapping of tags to assign to the resource.
|
2014-07-23 22:32:33 +02:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported:
|
|
|
|
|
|
|
|
* `id` - The ID of the VPC
|
|
|
|
* `cidr_block` - The CIDR block of the VPC
|
2014-12-10 11:39:14 +01:00
|
|
|
* `instance_tenancy` - Tenancy of instances spin up within VPC.
|
2014-08-09 14:43:00 +02:00
|
|
|
* `enable_dns_support` - Whether or not the VPC has DNS support
|
|
|
|
* `enable_dns_hostnames` - Whether or not the VPC has DNS hostname support
|
2015-11-20 16:48:48 +01:00
|
|
|
* `enable_classiclink` - Whether or not the VPC has Classiclink enabled
|
2014-10-11 01:57:32 +02:00
|
|
|
* `main_route_table_id` - The ID of the main route table associated with
|
2015-02-03 22:09:16 +01:00
|
|
|
this VPC. Note that you can change a VPC's main route table by using an
|
|
|
|
[`aws_main_route_table_association`](/docs/providers/aws/r/main_route_table_assoc.html).
|
2014-12-23 07:19:07 +01:00
|
|
|
* `default_network_acl_id` - The ID of the network ACL created by default on VPC creation
|
|
|
|
* `default_security_group_id` - The ID of the security group created by default on VPC creation
|
2016-08-25 23:02:44 +02:00
|
|
|
* `default_route_table_id` - The ID of the route table created by default on VPC creation
|
2017-03-01 17:16:59 +01:00
|
|
|
* `ipv6_association_id` - The association ID for the IPv6 CIDR block.
|
|
|
|
* `ipv6_cidr_block` - The IPv6 CIDR block.
|
2016-01-28 16:54:58 +01:00
|
|
|
|
|
|
|
|
2016-10-24 12:59:03 +02:00
|
|
|
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html
|
2016-07-19 18:22:30 +02:00
|
|
|
|
|
|
|
## Import
|
|
|
|
|
2017-02-18 23:48:50 +01:00
|
|
|
VPCs can be imported using the `vpc id`, e.g.
|
2016-07-19 18:22:30 +02:00
|
|
|
|
|
|
|
```
|
2016-07-26 08:35:52 +02:00
|
|
|
$ terraform import aws_vpc.test_vpc vpc-a01106c2
|
|
|
|
```
|