-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc_peering_routes.tf
83 lines (72 loc) · 2.76 KB
/
vpc_peering_routes.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* route_table core -> bastion */
resource "aws_route" "core_bastion" {
count = "${length(module.core.vpc_route_tables)}"
route_table_id = "${element(module.core.vpc_route_tables, count.index)}"
destination_cidr_block = "${module.bastion.vpc_cidr}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.core_bastion.id}"
depends_on = [
"module.bastion",
"module.core",
"aws_vpc_peering_connection.core_bastion",
]
}
/* route_table bastion -> core */
resource "aws_route" "bastion_core" {
count = "${length(module.bastion.vpc_route_tables)}"
route_table_id = "${element(module.bastion.vpc_route_tables, count.index)}"
destination_cidr_block = "${module.core.vpc_cidr}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.core_bastion.id}"
depends_on = [
"module.bastion",
"module.core",
"aws_vpc_peering_connection.core_bastion",
]
}
/* route_table core -> app */
resource "aws_route" "core_app" {
count = "${length(module.core.vpc_route_tables)}"
route_table_id = "${element(module.core.vpc_route_tables, count.index)}"
destination_cidr_block = "${module.app.vpc_cidr}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.core_app.id}"
depends_on = [
"module.app",
"module.core",
"aws_vpc_peering_connection.core_app",
]
}
/* route_table app -> core */
resource "aws_route" "app_core" {
count = "${length(module.app.vpc_route_tables)}"
route_table_id = "${element(module.app.vpc_route_tables, count.index)}"
destination_cidr_block = "${module.core.vpc_cidr}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.core_app.id}"
depends_on = [
"module.app",
"module.core",
"aws_vpc_peering_connection.core_app",
]
}
/* route_table bastion -> app */
resource "aws_route" "bastion_app" {
count = "${length(module.bastion.vpc_route_tables)}"
route_table_id = "${element(module.bastion.vpc_route_tables, count.index)}"
destination_cidr_block = "${module.app.vpc_cidr}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.bastion_app.id}"
depends_on = [
"module.bastion",
"module.app",
"aws_vpc_peering_connection.bastion_app",
]
}
/* route_table app -> bastion */
resource "aws_route" "app_bastion" {
count = "${length(module.app.vpc_route_tables)}"
route_table_id = "${element(module.app.vpc_route_tables, count.index)}"
destination_cidr_block = "${module.bastion.vpc_cidr}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.bastion_app.id}"
depends_on = [
"module.bastion",
"module.core",
"aws_vpc_peering_connection.bastion_app",
]
}