# snippet from terraform/env-dev/peering.tf | |
# import staging state, add routes from dev to staging | |
resource "terraform_remote_state" "staging_state" { | |
backend = "s3" | |
config { | |
bucket = "${var.tf_s3_bucket}" | |
region = "${var.region}" | |
key = "${var.staging_state_file}" | |
} | |
} | |
resource "aws_vpc_peering_connection" "its_probably_fine" { | |
peer_owner_id = "${var.acct_number}" | |
peer_vpc_id = "${terraform_remote_state.staging_state.output.staging_vpc_id}" | |
vpc_id = "${module.dev_vpc.vpc_id}" | |
auto_accept = "true" | |
tags { | |
Authored-by = "Ben Hartshorne" | |
Idea = "bad" | |
But = "ohwell" | |
XXX = "what's the worst that can happen?" | |
Environment = "development" | |
Name = "dev_to_staging_peering" | |
} | |
} | |
# route to public subnets | |
resource "aws_route" "dev_to_staging_route" { | |
route_table_id = "${module.dev_vpc.public_route_table_id}" | |
destination_cidr_block = "${terraform_remote_state.staging_state.output.staging_cidr_block}" | |
vpc_peering_connection_id = "${aws_vpc_peering_connection.its_probably_fine.id}" | |
} | |
# route *from* dev private subnets to staging | |
resource "aws_route" "dev_to_staging_int_route" { | |
count = "${length(split(",", var.private_ranges))}" | |
route_table_id = "${element(split(",", module.dev_vpc.private_route_table_id), count.index)}" | |
destination_cidr_block = "${terraform_remote_state.staging_state.output.staging_cidr_block}" | |
vpc_peering_connection_id = "${aws_vpc_peering_connection.its_probably_fine.id}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Sorry for ask but, how you implement the route tables in your vpc?