Skip to content

Commit 1f22d24

Browse files
authored
fix: Add back depends_on for data.wait_for_cluster (#1389)
1 parent 45f3b2f commit 1f22d24

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

cluster.tf

+12-20
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,6 @@ resource "aws_eks_cluster" "this" {
5252
]
5353
}
5454

55-
resource "aws_security_group_rule" "cluster_private_access" {
56-
description = "Allow private K8S API ingress from custom source."
57-
count = var.create_eks && var.cluster_create_endpoint_private_access_sg_rule && var.cluster_endpoint_private_access ? 1 : 0
58-
type = "ingress"
59-
from_port = 443
60-
to_port = 443
61-
protocol = "tcp"
62-
cidr_blocks = var.cluster_endpoint_private_access_cidrs
63-
64-
security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
65-
}
66-
67-
68-
data "http" "wait_for_cluster" {
69-
count = var.create_eks && var.manage_aws_auth ? 1 : 0
70-
url = format("%s/healthz", aws_eks_cluster.this[0].endpoint)
71-
ca_certificate = base64decode(coalescelist(aws_eks_cluster.this[*].certificate_authority[0].data, [""])[0])
72-
timeout = 300
73-
}
74-
7555
resource "aws_security_group" "cluster" {
7656
count = var.cluster_create_security_group && var.create_eks ? 1 : 0
7757
name_prefix = var.cluster_name
@@ -107,6 +87,18 @@ resource "aws_security_group_rule" "cluster_https_worker_ingress" {
10787
type = "ingress"
10888
}
10989

90+
resource "aws_security_group_rule" "cluster_private_access" {
91+
description = "Allow private K8S API ingress from custom source."
92+
count = var.create_eks && var.cluster_create_endpoint_private_access_sg_rule && var.cluster_endpoint_private_access ? 1 : 0
93+
type = "ingress"
94+
from_port = 443
95+
to_port = 443
96+
protocol = "tcp"
97+
cidr_blocks = var.cluster_endpoint_private_access_cidrs
98+
99+
security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
100+
}
101+
110102
resource "aws_iam_role" "cluster" {
111103
count = var.manage_cluster_iam_resources && var.create_eks ? 1 : 0
112104
name_prefix = var.cluster_iam_role_name != "" ? null : var.cluster_name

data.tf

+12
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ data "aws_iam_instance_profile" "custom_worker_group_launch_template_iam_instanc
8383
}
8484

8585
data "aws_partition" "current" {}
86+
87+
data "http" "wait_for_cluster" {
88+
count = var.create_eks && var.manage_aws_auth ? 1 : 0
89+
url = format("%s/healthz", aws_eks_cluster.this[0].endpoint)
90+
ca_certificate = base64decode(coalescelist(aws_eks_cluster.this[*].certificate_authority[0].data, [""])[0])
91+
timeout = 300
92+
93+
depends_on = [
94+
aws_eks_cluster.this,
95+
aws_security_group_rule.cluster_private_access,
96+
]
97+
}

0 commit comments

Comments
 (0)