Skip to content

Instantly share code, notes, and snippets.

@100daysofdevops
Created March 14, 2019 04:17
Show Gist options
  • Select an option

  • Save 100daysofdevops/b735bcbb7dbd9a4ca726449df5f4ba07 to your computer and use it in GitHub Desktop.

Select an option

Save 100daysofdevops/b735bcbb7dbd9a4ca726449df5f4ba07 to your computer and use it in GitHub Desktop.
resource "aws_vpc_peering_connection" "test-vpc" {
peer_vpc_id = "${var.secondary_vpc_id}"
vpc_id = "${var.primary_vpc_id}"
auto_accept = true
tags {
Name = "my-vpc-peering"
}
}
resource "aws_route" "vpc1-to-vpc2" {
route_table_id = "${var.vpc1_route_id}"
destination_cidr_block = "${var.vpc2_cidr_block}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.test-vpc.id}"
}
resource "aws_route" "vpc2-to-vpc1" {
route_table_id = "${var.vpc2_route_id}"
destination_cidr_block = "${var.vpc1_cidr_block}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.test-vpc.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment