1.8 KiB
1.8 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
aws | AWS: aws_vpc_peering_connection | docs-aws-resource-vpc-peering | Provides an VPC Peering Connection resource. |
aws_vpc_peering_connection
Provides an VPC Peering Connection resource.
Example Usage
Basic usage:
resource "aws_vpc_peering_connection" "foo" {
peer_owner_id = "${var.peer_owner_id}"
peer_vpc_id = "${aws_vpc.bar.id}"
vpc_id = "${aws_vpc.foo.id}"
}
Basic usage with tags:
resource "aws_vpc_peering_connection" "foo" {
peer_owner_id = "${var.peer_owner_id}"
peer_vpc_id = "${aws_vpc.bar.id}"
vpc_id = "${aws_vpc.foo.id}"
auto_accept = true
tags {
Name = "VPC Peering between foo and bar"
}
}
resource "aws_vpc" "foo" {
cidr_block = "10.1.0.0/16"
}
resource "aws_vpc" "bar" {
cidr_block = "10.2.0.0/16"
}
Argument Reference
The following arguments are supported:
peer_owner_id
- (Required) The AWS account ID of the owner of the peer VPC.peer_vpc_id
- (Required) The ID of the VPC with which you are creating the VPC peering connection.vpc_id
- (Required) The ID of the requester VPC.auto_accept
- (Optional) Accept the peering (you need to be the owner of both VPCs).tags
- (Optional) A mapping of tags to assign to the resource.
Attributes Reference
The following attributes are exported:
id
- The ID of the VPC Peering Connectionsaccept_status
- The Status of the VPC peering connection request.
Notes
If you are not the owner of both VPCs, or do not enable auto_accept you will still have to accept the peering with the AWS Console, aws-cli or aws-sdk-go.
Import
VPC Peering resources can be imported using the vpc peering id
, e.g.
$ terraform import aws_vpc_peering_connection.test_connection pcx-111aaa111