Skip to content

Commit 752c183

Browse files
fix: Worker security group handling when worker_create_security_group=false (#1461)
1 parent 577e16d commit 752c183

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cluster.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ resource "aws_security_group_rule" "cluster_egress_internet" {
8080
}
8181

8282
resource "aws_security_group_rule" "cluster_https_worker_ingress" {
83-
count = var.cluster_create_security_group && var.create_eks ? 1 : 0
83+
count = var.cluster_create_security_group && var.create_eks && var.worker_create_security_group ? 1 : 0
8484
description = "Allow pods to communicate with the EKS cluster API."
8585
protocol = "tcp"
8686
security_group_id = local.cluster_security_group_id

modules/node_groups/launch_template.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ resource "aws_launch_template" "workers" {
5252
network_interfaces {
5353
associate_public_ip_address = lookup(each.value, "public_ip", null)
5454
delete_on_termination = lookup(each.value, "eni_delete", null)
55-
security_groups = flatten([
55+
security_groups = compact(flatten([
5656
var.worker_security_group_id,
5757
var.worker_additional_security_group_ids,
5858
lookup(
5959
each.value,
6060
"additional_security_group_ids",
6161
null,
6262
),
63-
])
63+
]))
6464
}
6565

6666
# if you want to use a custom AMI

0 commit comments

Comments
 (0)