github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/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  ```
    16  resource "aws_vpc_peering_connection" "foo" {
    17      peer_owner_id = "${var.peer_owner_id}"
    18      peer_vpc_id = "${aws_vpc.bar.id}"
    19      vpc_id = "${aws_vpc.foo.id}"
    20  }
    21  ```
    22  
    23  Basic usage with connection options:
    24  
    25  ```
    26  resource "aws_vpc_peering_connection" "foo" {
    27      peer_owner_id = "${var.peer_owner_id}"
    28      peer_vpc_id = "${aws_vpc.bar.id}"
    29      vpc_id = "${aws_vpc.foo.id}"
    30  
    31      accepter {
    32        allow_remote_vpc_dns_resolution = true
    33      }
    34  
    35      requester {
    36        allow_remote_vpc_dns_resolution = true
    37      }
    38  }
    39  ```
    40  
    41  Basic usage with tags:
    42  
    43  ```
    44  
    45  resource "aws_vpc_peering_connection" "foo" {
    46      peer_owner_id = "${var.peer_owner_id}"
    47      peer_vpc_id = "${aws_vpc.bar.id}"
    48      vpc_id = "${aws_vpc.foo.id}"
    49      auto_accept = true
    50  
    51      tags {
    52        Name = "VPC Peering between foo and bar"
    53      }
    54  }
    55  
    56  resource "aws_vpc" "foo" {
    57      cidr_block = "10.1.0.0/16"
    58  }
    59  
    60  resource "aws_vpc" "bar" {
    61      cidr_block = "10.2.0.0/16"
    62  }
    63  ```
    64  
    65  ## Argument Reference
    66  
    67  -> **Note:** Modifying the VPC Peering Connection options requires peering to be active. An automatic activation
    68  can be done using the [`auto_accept`](vpc_peering.html#auto_accept) attribute. Alternatively, the VPC Peering
    69  Connection has to be made active manually using other means. See [notes](vpc_peering.html#notes) below for
    70  more information.
    71  
    72  The following arguments are supported:
    73  
    74  * `peer_owner_id` - (Required) The AWS account ID of the owner of the peer VPC.
    75     Defaults to the account ID the [AWS provider][1] is currently connected to.
    76  * `peer_vpc_id` - (Required) The ID of the VPC with which you are creating the VPC Peering Connection.
    77  * `vpc_id` - (Required) The ID of the requester VPC.
    78  * `auto_accept` - (Optional) Accept the peering (both VPCs need to be in the same AWS account).
    79  * `accepter` (Optional) - An optional configuration block that allows for [VPC Peering Connection]
    80  (http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide) options to be set for the VPC that accepts
    81  the peering connection (a maximum of one).
    82  * `requester` (Optional) - A optional configuration block that allows for [VPC Peering Connection]
    83  (http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide) options to be set for the VPC that requests
    84  the peering connection (a maximum of one).
    85  * `tags` - (Optional) A mapping of tags to assign to the resource.
    86  
    87  #### Accepter and Requester Arguments
    88  
    89  -> **Note:** When enabled, the DNS resolution feature requires that VPCs participating in the peering
    90  must have support for the DNS hostnames enabled. This can be done using the [`enable_dns_hostnames`]
    91  (vpc.html#enable_dns_hostnames) attribute in the [`aws_vpc`](vpc.html) resource. See [Using DNS with Your VPC]
    92  (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html) user guide for more information.
    93  
    94  * `allow_remote_vpc_dns_resolution` - (Optional) Allow a local VPC to resolve public DNS hostnames to private
    95  IP addresses when queried from instances in the peer VPC.
    96  * `allow_classic_link_to_remote_vpc` - (Optional) Allow a local linked EC2-Classic instance to communicate
    97  with instances in a peer VPC. This enables an outbound communication from the local ClassicLink connection
    98  to the remote VPC.
    99  * `allow_vpc_to_remote_classic_link` - (Optional) Allow a local VPC to communicate with a linked EC2-Classic
   100  instance in a peer VPC. This enables an outbound communication from the local VPC to the remote ClassicLink
   101  connection.
   102  
   103  ## Attributes Reference
   104  
   105  The following attributes are exported:
   106  
   107  * `id` - The ID of the VPC Peering Connection.
   108  * `accept_status` - The status of the VPC Peering Connection request.
   109  
   110  
   111  ## Notes
   112  
   113  AWS only supports VPC peering within the same AWS region.
   114  
   115  If both VPCs are not in the same AWS account 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  ```
   126  
   127  [1]: /docs/providers/aws/index.html