-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04_security_groups.tf
58 lines (49 loc) · 1.47 KB
/
04_security_groups.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
# resource definition to add ssh and web(http) security groups
# ssh security group
resource "aws_security_group" "vpc-ssh" {
name = "vpc-ssh"
description = "to allow traffic in ssh port"
ingress {
description = "To Allow inbound traffic to ssh port"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
description = "To Allow outbound traffic"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
/* Port-443 allows data transmission over a secured network, while Port 80 enables data transmission in plain text.
Users will get an insecure warning if he tries to access a non-HTTPS web page.
Port 443 encrypts network data packets before data transmission takes place.*/
# ssh security group
resource "aws_security_group" "vpc-web" {
name = "vpc-web"
description = "to allow traffic in web(http) port"
ingress {
description = "to allow inbound traffic in http port"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
description = "To allow inbound traffic to secure web traffic https port"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
description = "To allow all traffic outbound to all ports"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}