-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsg.tf
47 lines (42 loc) · 1.32 KB
/
sg.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
# EC2 Security Group to allow networking traffic within EKS cluster
resource "aws_security_group" "Group-eks" {
name = "Group-eks-${var.cluster-name}"
description = "Allow masters to communicate with nodes"
vpc_id = var.vpc-id
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group_rule" "Group-eks-self" {
self = true
description = "Allow communication with the cluster API Server"
from_port = 0
protocol = "-1"
security_group_id = aws_security_group.Group-eks.id
to_port = "0"
type = "ingress"
}
# EC2 Security Group to allow networking traffic between nodes
resource "aws_security_group" "Group-eks-nodes" {
name = "Group-eks-${var.cluster-name}-nodes"
description = "Allow nodes communication"
vpc_id = var.vpc-id
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group_rule" "Group-eks-nodes-self" {
self = true
description = "Allow commumication within nodes"
from_port = 0
protocol = "-1"
security_group_id = aws_security_group.Group-eks-nodes.id
to_port = "0"
type = "ingress"
}