Skip to content

Commit

Permalink
Add rule from eks nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
msingermann-domino committed Nov 15, 2024
1 parent 078249d commit 5b22e77
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
11 changes: 11 additions & 0 deletions modules/eks/node-group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,14 @@ resource "aws_security_group_rule" "netapp" {
description = "Netapp access from EKS nodes."
source_security_group_id = aws_security_group.eks_nodes.id
}

resource "aws_security_group_rule" "ecr_endpoint" {
count = var.network_info.ecr_endpoint_sg_id != null ? 1 : 0
security_group_id = var.network_info.ecr_endpoint_sg_id
protocol = "tcp"
from_port = 443
to_port = 443
type = "ingress"
description = "ECR Endpoint access from EKS nodes."
source_security_group_id = aws_security_group.eks_nodes.id
}
2 changes: 2 additions & 0 deletions modules/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ variable "region" {
variable "network_info" {
description = <<EOF
id = VPC ID.
ecr_endpoint_sg_id = ECR Endpoint security group id.
subnets = {
public = List of public Subnets.
[{
Expand All @@ -47,6 +48,7 @@ variable "network_info" {
EOF
type = object({
vpc_id = string
ecr_endpoint_sg_id = string
subnets = object({
public = list(object({
name = string
Expand Down
1 change: 1 addition & 0 deletions modules/infra/submodules/network/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ output "info" {
vpc_cidrs = var.network.cidrs.vpc
pod_cidrs = var.network.cidrs.pod
s3_cidrs = data.aws_prefix_list.s3.cidr_blocks
ecr_endpoint_sg_id = data.aws_security_group.ecr_endpoint.id
}
}
16 changes: 0 additions & 16 deletions modules/infra/submodules/network/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,6 @@ resource "aws_security_group" "ecr_endpoint" {
description = "ECR Endpoint security group"
vpc_id = aws_vpc.this[0].id

ingress {
description = "Node to node https traffic"
protocol = "tcp"
from_port = 443
to_port = 443
self = true
}

egress {
description = "Allow outbound TCP traffic."
from_port = 0
to_port = 65535
protocol = "tcp"
self = true
}

lifecycle {
create_before_destroy = true
}
Expand Down

0 comments on commit 5b22e77

Please sign in to comment.