-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc.tf
73 lines (59 loc) · 1.38 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
resource "aws_vpc" "jenkins" {
cidr_block = var.vpc_cidr
enable_dns_hostnames = true
tags = {
Name = "Jenkins-VPC"
}
}
resource "aws_internet_gateway" "jenkins-igw" {
vpc_id = aws_vpc.jenkins.id
tags = {
Name = "Jenkins-IGW"
}
}
resource "aws_default_route_table" "jenkins-default-route-table" {
default_route_table_id = aws_vpc.jenkins.default_route_table_id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.jenkins-igw.id
}
tags = {
Name = "Jenkins-Default-Route-Table"
}
}
resource "aws_subnet" "jenkins-pub-sn" {
vpc_id = aws_vpc.jenkins.id
cidr_block = var.public_subnet_cidr
map_public_ip_on_launch = true
availability_zone = var.subnet-az
tags = {
Name = "Jenkins-Pub-SN"
}
}
resource "aws_default_security_group" "jenkins-default-sg" {
vpc_id = aws_vpc.jenkins.id
ingress {
description = "SSH Traffic"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
description = "HTTP Traffic"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
description = "All Traffic"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "Jenkins SG"
}
}