Skip to content

Commit

Permalink
add rds sg
Browse files Browse the repository at this point in the history
  • Loading branch information
yordanovsstoyan committed Nov 12, 2024
1 parent 5229713 commit 7868ee1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ecr.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_ecr_repository" "ecr" {
name = var.ecr_name
name = var.ecr_name
image_tag_mutability = "MUTABLE"
image_scanning_configuration {
scan_on_push = true
Expand Down
32 changes: 16 additions & 16 deletions eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,6 @@ module "eks" {
to_port = "10250"
type = "ingress"
self = true
},
rds_ingress = {
description = "communication between control plane and the metrics-server endpoint"
protocol = "tcp"
from_port = "1024"
to_port = "65535"
type = "ingress"
source_cluster_security_group = true
},
rds_egress = {
description = "communication between control plane and the metrics-server endpoint"
protocol = "tcp"
from_port = "3306"
to_port = "3306"
type = "egress"
source_cluster_security_group = true
}
}

Expand All @@ -108,6 +92,22 @@ module "eks" {
Environment = "dev"
}
}
resource "aws_security_group_rule" "eks_rds_ingress" {
security_group_id = module.eks.node_security_group_id
type = "ingress"
from_port = 1024
to_port = 65535
protocol = "tcp"
source_security_group_id = aws_security_group.db_server_sg.id
}
resource "aws_security_group_rule" "eks_rds_egress" {
security_group_id = module.eks.node_security_group_id
type = "egress"
from_port = 3306
to_port = 3306
protocol = "tcp"
source_security_group_id = aws_security_group.db_server_sg.id
}

# https://github.com/terraform-aws-modules/terraform-aws-eks/issues/2009
data "aws_eks_cluster" "default" {
Expand Down

0 comments on commit 7868ee1

Please sign in to comment.