Skip to content

Commit 0c8c5b5

Browse files
barryibArchiFleKs
authored andcommitted
fix: Remove duplicated security group rule for EKS private access endpoint (terraform-aws-modules#1412)
NOTES: In this bug fix, we remove a duplicated security rule introduced during a merge conflict resolution in [terraform-aws-modules#1274](terraform-aws-modules#1274)
1 parent 311a797 commit 0c8c5b5

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
193193
| [aws_security_group_rule.cluster_egress_internet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
194194
| [aws_security_group_rule.cluster_https_worker_ingress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
195195
| [aws_security_group_rule.cluster_primary_ingress_workers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
196-
| [aws_security_group_rule.cluster_private_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
197196
| [aws_security_group_rule.cluster_private_access_cidrs_source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
198197
| [aws_security_group_rule.cluster_private_access_sg_source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
199198
| [aws_security_group_rule.workers_egress_internet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |

cluster.tf

+2-12
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ resource "aws_security_group_rule" "cluster_https_worker_ingress" {
8989

9090
resource "aws_security_group_rule" "cluster_private_access_cidrs_source" {
9191
count = var.create_eks && var.cluster_create_endpoint_private_access_sg_rule && var.cluster_endpoint_private_access && var.cluster_endpoint_private_access_cidrs != null ? 1 : 0
92+
description = "Allow private K8S API ingress from custom CIDR source."
9293
type = "ingress"
9394
from_port = 443
9495
to_port = 443
@@ -100,6 +101,7 @@ resource "aws_security_group_rule" "cluster_private_access_cidrs_source" {
100101

101102
resource "aws_security_group_rule" "cluster_private_access_sg_source" {
102103
count = var.create_eks && var.cluster_create_endpoint_private_access_sg_rule && var.cluster_endpoint_private_access && var.cluster_endpoint_private_access_sg != null ? length(var.cluster_endpoint_private_access_sg) : 0
104+
description = "Allow private K8S API ingress from custom Security Groups source."
103105
type = "ingress"
104106
from_port = 443
105107
to_port = 443
@@ -109,18 +111,6 @@ resource "aws_security_group_rule" "cluster_private_access_sg_source" {
109111
security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
110112
}
111113

112-
resource "aws_security_group_rule" "cluster_private_access" {
113-
description = "Allow private K8S API ingress from custom source."
114-
count = var.create_eks && var.cluster_create_endpoint_private_access_sg_rule && var.cluster_endpoint_private_access ? 1 : 0
115-
type = "ingress"
116-
from_port = 443
117-
to_port = 443
118-
protocol = "tcp"
119-
cidr_blocks = var.cluster_endpoint_private_access_cidrs
120-
121-
security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
122-
}
123-
124114
resource "aws_iam_role" "cluster" {
125115
count = var.manage_cluster_iam_resources && var.create_eks ? 1 : 0
126116
name_prefix = var.cluster_iam_role_name != "" ? null : var.cluster_name

data.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ data "http" "wait_for_cluster" {
9494

9595
depends_on = [
9696
aws_eks_cluster.this,
97-
aws_security_group_rule.cluster_private_access,
97+
aws_security_group_rule.cluster_private_access_sg_source,
98+
aws_security_group_rule.cluster_private_access_cidrs_source,
9899
]
99100
}

0 commit comments

Comments
 (0)