Terraform module which creates VPC peering resources on AWS.
These types of resources are supported:
This module can be used to setup VPC peering cross account, or within the same account, you just need to call the module multiple times, at least 2, one for the requester side and one for the accepter side.
Keep in mind that in order to accomplish this behaviour with the module we do not have any mandatory/required variables.
Requester side:
module "vpc_peering_requester" {
source = "github.com/full360/terraform-aws-vpc-peering"
requester = true
accepter_owner_id = "1234567890"
accepter_vpc_id = "vpc-654321"
accepter_region = "us-east-1"
accepter_cidr_block = "172.16.0.0/24"
requester_vpc_id = "vpc-123456"
requester_private_route_table_ids = [
"rtb-987656a1e6becddb4",
]
requester_public_route_table_ids = [
"rtb-123456a1e6becddb3",
]
tags = "${merge(map("Name", "my-peering-connection"), var.tags)}"
}
Accepter side:
module "vpc_peering_accepter" {
source = "github.com/full360/terraform-aws-vpc-peering"
accepter = true
auto_accept = true
vpc_peering_connection_id = "pcx-1234567530b90e383"
requester_cidr_block = "172.32.0.0/24"
accepter_private_route_table_ids = [
"rtb-0987654321becddb2",
]
accepter_public_route_table_ids = [
"rtb-1234567890becddb1",
]
tags = "${merge(map("Name", "my-peering-connection"), var.tags)}"
}
Name | Description | Type | Default | Required |
---|---|---|---|---|
accepter | Flag to know the VPC peering side | string | "false" |
no |
accepter_cidr_block | CIDR block of the accepter side | string | "" |
no |
accepter_owner_id | Account ID of the accepter side | string | "" |
no |
accepter_region | Region of the VPC where the accepter connection is | string | "" |
no |
accepter_route_table_ids | List of route table ids from the accepter side | list | [] |
no |
accepter_tags | Additional tags for the accepter side | map | { "Side": "accepter" } |
no |
accepter_vpc_id | VPC ID of the accepter side | string | "" |
no |
allow_classic_link_to_remote_vpc | Allow Classic Link to remote VPC | string | "false" |
no |
allow_remote_vpc_dns_resolution | Allow remote VPC DNS resolution | string | "true" |
no |
allow_vpc_to_remote_classic_link | Allow VPC to remote Classic Link | string | "false" |
no |
auto_accept | Auto accept the peering | string | "false" |
no |
requester | Flag to know the VPC peering side | string | "false" |
no |
requester_cidr_block | CIDR block of the requester side | string | "" |
no |
requester_options | Flag to enable the requester options | string | "false" |
no |
requester_route_table_ids | List of route table ids from the requester side | list | [] |
no |
requester_tags | Additional tags for the requester side | map | { "Side": "requester" } |
no |
requester_vpc_id | VPC ID of the requester side | string | "" |
no |
tags | Map of Tags of the peering connection | map | {} |
no |
vpc_peering_connection_id | ID of the VPC peering connection when accepting the connection | string | "" |
no |
Name | Description |
---|---|
connection_id | ID of the VPC peering connection |
Apache License Version 2.0. See LICENSE for full details.