Skip to content

Commit

Permalink
Rename sg_ports.tf and clean up duplicate rules (#42)
Browse files Browse the repository at this point in the history
- Rename sg_ports.tf to additional_sg_rules.tf
- Clean up duplicate rules
- Add a comment

---------

Co-authored-by: Matthew Creal Morgan <matthew.c.morgan@census.gov>
  • Loading branch information
yang0352 and morga471 committed Apr 18, 2025
1 parent d835a31 commit 159a98a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 57 deletions.
21 changes: 21 additions & 0 deletions additional_sg_rules.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
locals {
node_security_group_additional_rules = {
ingress_nodes_ephemeral = {
description = "Node to node ingress on ephemeral ports"
from_port = 80
protocol = "tcp"
self = true
to_port = 65535
type = "ingress"
}
# ALB controller, NGINX
ingress_cluster_9443_webhook = {
description = "Cluster API to node 9443/tcp webhook"
from_port = 9443
protocol = "tcp"
source_cluster_security_group = true
to_port = 9443
type = "ingress"
}
}
}
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ resource "aws_ec2_tag" "container_subnets" {
}
}

# NOTE: Because the source SG of this rule is the primary SG of the cluster,
# we cannot add it to "node_security_group_additional_rules" map, which is
# referenced by cluster module. It will create circular dependency.
resource "aws_security_group_rule" "allow_sidecar_injection" {
description = "Webhook container port, from Control Plane"
protocol = "tcp"
Expand Down
57 changes: 0 additions & 57 deletions sg_ports.tf

This file was deleted.

0 comments on commit 159a98a

Please sign in to comment.