-
Notifications
You must be signed in to change notification settings - Fork 2
/
sg.tf
29 lines (27 loc) · 861 Bytes
/
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
resource "aws_security_group" "cluster" {
name = "${local.prefix}-eks-cluster-sg"
description = "EKS security group for controll access to cluster api"
vpc_id = var.vpc_id
tags = merge(
{
"Name" = "${local.prefix}-eks-cluster-sg"
},
local.tags
)
}
resource "aws_security_group_rule" "eks_ingress_allow_tls" {
type = "ingress"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = concat([data.aws_vpc.this.cidr_block], var.additional_allow_cidr)
security_group_id = aws_security_group.cluster.id
}
resource "aws_security_group_rule" "eks_egress_allow_all" {
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_security_group.cluster.id
}