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