natgw-eip-b.tf 2.57 KB
Newer Older
drechsau's avatar
drechsau committed
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
resource "aws_eip" "natgw-b" {
  vpc = true
}

resource "aws_nat_gateway" "natgw-b" {
  allocation_id = "${aws_eip.natgw-b.id}"
  subnet_id     = "${aws_subnet.drone-deploy-mgmt-b.id}"
}

# create route tables
resource "aws_route_table" "az-b" {
  vpc_id = "${module.vpc.vpc_id}"

  #propagating_vgws = ["${var.private_propagating_vgws_1}"]

  tags {
    Name = "${var.name}-rt-natgw-b"
  }
}

# create default route for route tables
resource "aws_route" "nategw-b" {
  route_table_id         = "${aws_route_table.az-b.id}"
  destination_cidr_block = "0.0.0.0/0"
  nat_gateway_id         = "${aws_nat_gateway.natgw-b.id}"
}

# associate AZ routes to AZ NAT route tables
resource "aws_route_table_association" "drone-deploy-mgmt-b" {
  subnet_id = "${aws_subnet.drone-deploy-mgmt-b.id}"

  route_table_id = "${module.vpc.public_route_table_id}"
}

resource "aws_route_table_association" "c1-elb-b" {
  subnet_id = "${aws_subnet.c1-elb-b.id}"

  route_table_id = "${module.vpc.public_route_table_id}"
}

#resource "aws_route_table_association" "c1-databases-b" {
#  subnet_id = "${aws_subnet.c1-databases-b.id}"
#
#  route_table_id = "${aws_route_table.az-b.id}"
#}

#resource "aws_route_table_association" "c1-elasticache-b" {
#  subnet_id = "${aws_subnet.c1-elasticache-b.id}"
#
#  route_table_id = "${aws_route_table.az-b.id}"
#}

resource "aws_route_table_association" "c1-docker-pub-b" {
  subnet_id = "${aws_subnet.c1-docker-pub-b.id}"

  #route_table_id = "${module.vpc.public_route_table_id}"
  route_table_id = "${aws_route_table.az-b.id}"
}

resource "aws_route_table_association" "c1-docker-priv-b" {
  subnet_id = "${aws_subnet.c1-docker-priv-b.id}"

  route_table_id = "${aws_route_table.az-b.id}"
}

resource "aws_route_table_association" "c1-app-b" {
  subnet_id = "${aws_subnet.c1-app-b.id}"

  route_table_id = "${aws_route_table.az-b.id}"
}

resource "aws_route_table_association" "c1-admin-b" {
  subnet_id = "${aws_subnet.c1-admin-b.id}"

  route_table_id = "${aws_route_table.az-b.id}"
}

resource "aws_route_table_association" "c1-elb-admin-b" {
  subnet_id = "${aws_subnet.c1-elb-admin-b.id}"

  route_table_id = "${aws_route_table.az-b.id}"
}

resource "aws_route_table_association" "c1-elb-client-b" {
  subnet_id = "${aws_subnet.c1-elb-client-b.id}"

  route_table_id = "${aws_route_table.az-b.id}"
}

#resource "aws_route_table_association" "c1-efs-b" {
#  subnet_id = "${aws_subnet.c1-efs-b.id}"
#
#  route_table_id = "${aws_route_table.az-b.id}"
#}

resource "aws_route_table_association" "c1-cmgmt-b" {
  subnet_id = "${aws_subnet.c1-cmgmt-b.id}"

  route_table_id = "${module.vpc.public_route_table_id}"
}