vpc-peering
Creates VPC peering connections with automatic accepter wiring and route table updates.
Provisions VPC peering connections (same-account intra-region, cross-account, or cross-region), accepts same-account connections automatically, and installs routes in both the requester and accepter route tables. Cross-account and cross-region acceptance must be performed via a provider alias in the calling stack.
Usage
module "vpc_peering" {
source = "hcassc.jfrog.io/iac-terraform-modules-virtual/networking/vpc-peering/aws"
version = "0.1.0"
peering_connections = {
prod_to_shared = {
requester_vpc_id = module.prod_vpc.id
peer_vpc_id = module.shared_vpc.id
requester_cidr = "10.0.0.0/16"
accepter_cidr = "10.1.0.0/16"
requester_route_tables = values(module.prod_vpc.private_route_table_ids)
accepter_route_tables = values(module.shared_vpc.private_route_table_ids)
}
}
}
Requirements
Providers
Resources
| Name |
Description |
Type |
Default |
Required |
| peering_connections |
Map of VPC peering connections. peer_vpc_id is the accepter VPC.peer_account_id and peer_region are required for cross-account / cross-region peering.auto_accept requires both VPCs in the same account and region. |
map(object({ requester_vpc_id = string peer_vpc_id = string peer_account_id = optional(string, null) peer_region = optional(string, null) auto_accept = optional(bool, false) allow_remote_vpc_dns = optional(bool, true) requester_route_tables = optional(list(string), []) accepter_route_tables = optional(list(string), []) requester_cidr = optional(string, null) accepter_cidr = optional(string, null) })) |
{} |
no |
| tags |
Resource tags to apply to all resources |
map(string) |
{} |
no |
Outputs