Skip to content

Instantly share code, notes, and snippets.

@oogali
Last active December 16, 2017 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oogali/87b2b9cce3de2c1645e9c6cbee87547e to your computer and use it in GitHub Desktop.
Save oogali/87b2b9cce3de2c1645e9c6cbee87547e to your computer and use it in GitHub Desktop.
Just waiting on Terraform AWS provider to support inter-region VPC peering...
# Pending apply... needs https://github.com/terraform-providers/terraform-provider-aws/issues/2484
#
resource "aws_vpc_peering_connection" "north-virginia-to-ohio" {
provider = "aws.us-east-1"
vpc_id = "${module.us-north-virginia.vpc_id}"
peer_region = "us-east-2"
peer_vpc_id = "${module.us-ohio.vpc_id}"
accepter {
allow_remote_vpc_dns_resolution = true
}
requester {
allow_remote_vpc_dns_resolution = true
}
tags {
Name = "North Virginia-Ohio VPC Peering Connection"
}
}
resource "aws_vpc_peering_connection" "ohio-to-north-virginia" {
provider = "aws.us-east-2"
vpc_id = "${module.us-ohio.vpc_id}"
peer_region = "us-east-1"
peer_vpc_id = "${module.us-north-virginia.vpc_id}"
accepter {
allow_remote_vpc_dns_resolution = true
}
requester {
allow_remote_vpc_dns_resolution = true
}
tags {
Name = "North Virginia-Ohio VPC Peering Connection"
}
}
resource "aws_route" "north-virginia-to-ohio" {
provider = "aws.us-east-1"
vpc_id = "${module.us-north-virginia.vpc_id}"
route_table_id = "${module.us-north-virginia.vpc_routing_table}"
destination_cidr_block = "${var.aws-ohio-cidr-block}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.north-virginia-to-ohio.id}"
}
resource "aws_route" "ohio-to-north-virginia" {
provider = "aws.us-east-2"
vpc_id = "${module.us-ohio.vpc_id}"
route_table_id = "${module.us-ohio.vpc_routing_table}"
destination_cidr_block = "${var.aws-north-virginia-cidr-block}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.ohio-to-north-virginia.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment