-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathsubnets.tf
75 lines (63 loc) · 1.44 KB
/
subnets.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
# public subnet #1 for NAT gw
resource "aws_subnet" "public_nat_1" {
cidr_block = "10.0.0.0/28"
vpc_id = "${aws_vpc.project.id}"
availability_zone = "eu-west-1b"
tags {
Name = "Nat #1"
Visibility = "Public"
}
}
# public subnet #2 for NAT gw
resource "aws_subnet" "public_nat_2" {
cidr_block = "10.0.0.16/28"
vpc_id = "${aws_vpc.project.id}"
availability_zone = "eu-west-1c"
tags {
Name = "Nat #2"
Visibility = "Public"
}
}
# private subnet #1 for RDS
resource "aws_subnet" "private_rds_1" {
count = "${var.rds ? 1 : 0 }"
cidr_block = "10.0.0.32/27"
vpc_id = "${aws_vpc.project.id}"
availability_zone = "eu-west-1b"
tags {
Name = "RDS #1"
Visibility = "Private"
}
}
# private subnet #2 for RDS
resource "aws_subnet" "private_rds_2" {
count = "${var.rds ? 1 : 0 }"
cidr_block = "10.0.0.64/27"
vpc_id = "${aws_vpc.project.id}"
availability_zone = "eu-west-1c"
tags {
Name = "RDS #2"
Visibility = "Private"
}
}
# private subnet #1
resource "aws_subnet" "private_app_1" {
cidr_block = "10.0.1.0/24"
vpc_id = "${aws_vpc.project.id}"
availability_zone = "eu-west-1b"
tags {
Name = "App #1"
Visibility = "Private"
}
}
# private subnet #2
resource "aws_subnet" "private_app_2" {
count = "${var.multi_az ? 1 : 0}"
cidr_block = "10.0.2.0/24"
vpc_id = "${aws_vpc.project.id}"
availability_zone = "eu-west-1c"
tags {
Name = "App #2"
Visibility = "Private"
}
}