-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpc.tf
74 lines (56 loc) · 1.64 KB
/
vpc.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
resource "aws_vpc" "packy-v2-vpc" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "packy-v2-vpc"
}
}
resource "aws_subnet" "packy-v2-public-subnet-01" {
vpc_id = aws_vpc.packy-v2-vpc.id
cidr_block = "10.0.1.0/24"
availability_zone = "ap-northeast-2a"
map_public_ip_on_launch = true # 퍼블릭 IP 자동 할당
tags = {
Name = "packy-v2-public-subnet-01"
}
}
resource "aws_subnet" "packy-v2-public-subnet-02" {
vpc_id = aws_vpc.packy-v2-vpc.id
cidr_block = "10.0.2.0/24"
availability_zone = "ap-northeast-2c"
tags = {
Name = "packy-v2-public-subnet-02"
}
}
resource "aws_internet_gateway" "packy-v2-igw" {
vpc_id = aws_vpc.packy-v2-vpc.id
tags = {
Name = "packy-v2-igw"
}
}
resource "aws_route_table" "packy-v2-public-rt" {
vpc_id = aws_vpc.packy-v2-vpc.id
tags = {
Name = "packy-v2-public-rt"
}
}
resource "aws_route_table_association" "packy-v2-public-rt-subnet-01" {
subnet_id = aws_subnet.packy-v2-public-subnet-01.id
route_table_id = aws_route_table.packy-v2-public-rt.id
}
resource "aws_route_table_association" "packy-v2-public-rt-subnet-02" {
subnet_id = aws_subnet.packy-v2-public-subnet-02.id
route_table_id = aws_route_table.packy-v2-public-rt.id
}
resource "aws_route" "packy-v2-internet-access" {
route_table_id = aws_route_table.packy-v2-public-rt.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.packy-v2-igw.id
}
resource "aws_subnet" "packy-v2-private-subnet-01" {
vpc_id = aws_vpc.packy-v2-vpc.id
cidr_block = "10.0.3.0/24"
availability_zone = "ap-northeast-2a"
tags = {
Name = "packy-v2-private-subnet-01"
}
}