github.com/daveadams/terraform@v0.6.4-0.20160830094355-13ce74975936/website/source/docs/providers/aws/r/vpc_peering.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_vpc_peering_connection" 4 sidebar_current: "docs-aws-resource-vpc-peering" 5 description: |- 6 Provides an VPC Peering Connection resource. 7 --- 8 9 # aws\_vpc\_peering\_connection 10 11 Provides an VPC Peering Connection resource. 12 13 ## Example Usage 14 15 Basic usage: 16 17 ``` 18 resource "aws_vpc_peering_connection" "foo" { 19 peer_owner_id = "${var.peer_owner_id}" 20 peer_vpc_id = "${aws_vpc.bar.id}" 21 vpc_id = "${aws_vpc.foo.id}" 22 } 23 ``` 24 25 Basic usage with connection options: 26 27 ``` 28 resource "aws_vpc_peering_connection" "foo" { 29 peer_owner_id = "${var.peer_owner_id}" 30 peer_vpc_id = "${aws_vpc.bar.id}" 31 vpc_id = "${aws_vpc.foo.id}" 32 33 accepter { 34 allow_remote_vpc_dns_resolution = true 35 } 36 37 requester { 38 allow_remote_vpc_dns_resolution = true 39 } 40 } 41 ``` 42 43 Basic usage with tags: 44 45 ``` 46 47 resource "aws_vpc_peering_connection" "foo" { 48 peer_owner_id = "${var.peer_owner_id}" 49 peer_vpc_id = "${aws_vpc.bar.id}" 50 vpc_id = "${aws_vpc.foo.id}" 51 52 auto_accept = true 53 54 tags { 55 Name = "VPC Peering between foo and bar" 56 } 57 } 58 59 resource "aws_vpc" "foo" { 60 cidr_block = "10.1.0.0/16" 61 } 62 63 resource "aws_vpc" "bar" { 64 cidr_block = "10.2.0.0/16" 65 } 66 ``` 67 68 ## Argument Reference 69 70 -> **Note:** Modifying the VPC Peering Connection options requires peering to be active. An automatic activation 71 can be done using the [`auto_accept`](vpc_peering.html#auto_accept) attribute. Alternatively, the VPC Peering 72 Connection has to be made active manually using other means. See [notes](vpc_peering.html#notes) below for 73 more information. 74 75 The following arguments are supported: 76 77 * `peer_owner_id` - (Required) The AWS account ID of the owner of the peer VPC. 78 * `peer_vpc_id` - (Required) The ID of the VPC with which you are creating the VPC Peering Connection. 79 * `vpc_id` - (Required) The ID of the requester VPC. 80 * `auto_accept` - (Optional) Accept the peering (you need to be the owner of both VPCs). 81 * `accepter` (Optional) - An optional configuration block that allows for [VPC Peering Connection] 82 (http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide) options to be set for the VPC that accepts 83 the peering connection (a maximum of one). 84 * `requester` (Optional) - A optional configuration block that allows for [VPC Peering Connection] 85 (http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide) options to be set for the VPC that requests 86 the peering connection (a maximum of one). 87 * `tags` - (Optional) A mapping of tags to assign to the resource. 88 89 #### Accepter and Requester Arguments 90 91 -> **Note:** When enabled, the DNS resolution feature requires that VPCs participating in the peering 92 must have support for the DNS hostnames enabled. This can be done using the [`enable_dns_hostnames`] 93 (vpc.html#enable_dns_hostnames) attribute in the [`aws_vpc`](vpc.html) resource. See [Using DNS with Your VPC] 94 (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html) user guide for more information. 95 96 * `allow_remote_vpc_dns_resolution` - (Optional) Allow a local VPC to resolve public DNS hostnames to private 97 IP addresses when queried from instances in the peer VPC. 98 * `allow_classic_link_to_remote_vpc` - (Optional) Allow a local linked EC2-Classic instance to communicate 99 with instances in a peer VPC. This enables an outbound communication from the local ClassicLink connection 100 to the remote VPC. 101 * `allow_vpc_to_remote_classic_link` - (Optional) Allow a local VPC to communicate with a linked EC2-Classic 102 instance in a peer VPC. This enables an outbound communication from the local VPC to the remote ClassicLink 103 connection. 104 105 ## Attributes Reference 106 107 The following attributes are exported: 108 109 * `id` - The ID of the VPC Peering Connection. 110 * `accept_status` - The status of the VPC Peering Connection request. 111 112 113 ## Notes 114 115 If you are not the owner of both VPCs, or do not enable the `auto_accept` attribute you will still 116 have to accept the VPC Peering Connection request manually using the AWS Management Console, AWS CLI, 117 through SDKs, etc. 118 119 ## Import 120 121 VPC Peering resources can be imported using the `vpc peering id`, e.g. 122 123 ``` 124 $ terraform import aws_vpc_peering_connection.test_connection pcx-111aaa111 125 ```