-
Notifications
You must be signed in to change notification settings - Fork 0
/
subnet.tf
104 lines (79 loc) · 3.05 KB
/
subnet.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# =====================================================
# Creating Subnets Public1
# =====================================================
resource "aws_subnet" "Public1" {
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(var.vpc_cidr,3,0)
availability_zone = data.aws_availability_zones.az.names[0]
map_public_ip_on_launch = true
tags = {
Name = "${var.project}-public1-sg"
project = var.project
}
}
# =====================================================
# Creating Subnets Public2
# =====================================================
resource "aws_subnet" "Public2" {
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(var.vpc_cidr,3,1)
availability_zone = data.aws_availability_zones.az.names[1]
map_public_ip_on_launch = true
tags = {
Name = "${var.project}-public2-sg"
project = var.project
}
}
# =====================================================
# Creating Subnets Public3
# =====================================================
resource "aws_subnet" "Public3" {
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(var.vpc_cidr,3,2)
availability_zone = data.aws_availability_zones.az.names[2]
map_public_ip_on_launch = true
tags = {
Name = "${var.project}-public3-sg"
project = var.project
}
}
#=================================================================================================
# =====================================================
# Creating Subnets private1
# =====================================================
resource "aws_subnet" "private1" {
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(var.vpc_cidr,3,3)
availability_zone = data.aws_availability_zones.az.names[0]
map_public_ip_on_launch = false
tags = {
Name = "${var.project}-private1-sg"
project = var.project
}
}
# =====================================================
# Creating Subnets private2
# =====================================================
resource "aws_subnet" "private2" {
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(var.vpc_cidr,3,4)
availability_zone = data.aws_availability_zones.az.names[1]
map_public_ip_on_launch = false
tags = {
Name = "${var.project}-private2-sg"
project = var.project
}
}
# =====================================================
# Creating Subnets private3
# =====================================================
resource "aws_subnet" "private3" {
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(var.vpc_cidr,3,5)
availability_zone = data.aws_availability_zones.az.names[2]
map_public_ip_on_launch = false
tags = {
Name = "${var.project}-private3-sg"
project = var.project
}
}