-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
eks-addon-coredns.tf
56 lines (43 loc) · 1.61 KB
/
eks-addon-coredns.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
#####
# CoreDNS Security Group
#####
resource "aws_security_group" "core_dns" {
name_prefix = "${var.name_prefix}-coredns-sg-"
description = "EKS CoreDNS security group."
vpc_id = module.vpc_eks.vpc_id
tags = {
"Name" = "${var.name_prefix}-coredns-sg"
"kubernetes.io/cluster/${var.name_prefix}" = "owned"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_vpc_security_group_ingress_rule" "all_allow_access_from_control_plane_to_core_dns" {
security_group_id = aws_security_group.core_dns.id
description = "Allow communication from control plan to CoreDNS security group."
referenced_security_group_id = aws_eks_cluster.cluster.vpc_config[0].cluster_security_group_id
ip_protocol = "-1"
}
resource "aws_vpc_security_group_ingress_rule" "all_allow_access_from_karpenter_nodes_to_core_dns" {
security_group_id = aws_security_group.core_dns.id
description = "Allow communication from karpenter nodes to CoreDNS security group."
referenced_security_group_id = aws_security_group.node.id
ip_protocol = "-1"
}
resource "aws_vpc_security_group_egress_rule" "core_dns_udp" {
security_group_id = aws_security_group.core_dns.id
description = "Allow udp egress."
from_port = "53"
to_port = "53"
ip_protocol = "udp"
cidr_ipv4 = "0.0.0.0/0"
}
resource "aws_vpc_security_group_egress_rule" "core_dns_tcp" {
security_group_id = aws_security_group.core_dns.id
description = "Allow udp egress."
from_port = "53"
to_port = "53"
ip_protocol = "tcp"
cidr_ipv4 = "0.0.0.0/0"
}