Skip to content

Commit

Permalink
fix: Add back depends_on for data.wait_for_cluster (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
barryib authored May 25, 2021
1 parent 45f3b2f commit 1f22d24
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
32 changes: 12 additions & 20 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,6 @@ resource "aws_eks_cluster" "this" {
]
}

resource "aws_security_group_rule" "cluster_private_access" {
description = "Allow private K8S API ingress from custom source."
count = var.create_eks && var.cluster_create_endpoint_private_access_sg_rule && var.cluster_endpoint_private_access ? 1 : 0
type = "ingress"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = var.cluster_endpoint_private_access_cidrs

security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
}


data "http" "wait_for_cluster" {
count = var.create_eks && var.manage_aws_auth ? 1 : 0
url = format("%s/healthz", aws_eks_cluster.this[0].endpoint)
ca_certificate = base64decode(coalescelist(aws_eks_cluster.this[*].certificate_authority[0].data, [""])[0])
timeout = 300
}

resource "aws_security_group" "cluster" {
count = var.cluster_create_security_group && var.create_eks ? 1 : 0
name_prefix = var.cluster_name
Expand Down Expand Up @@ -107,6 +87,18 @@ resource "aws_security_group_rule" "cluster_https_worker_ingress" {
type = "ingress"
}

resource "aws_security_group_rule" "cluster_private_access" {
description = "Allow private K8S API ingress from custom source."
count = var.create_eks && var.cluster_create_endpoint_private_access_sg_rule && var.cluster_endpoint_private_access ? 1 : 0
type = "ingress"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = var.cluster_endpoint_private_access_cidrs

security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
}

resource "aws_iam_role" "cluster" {
count = var.manage_cluster_iam_resources && var.create_eks ? 1 : 0
name_prefix = var.cluster_iam_role_name != "" ? null : var.cluster_name
Expand Down
12 changes: 12 additions & 0 deletions data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,15 @@ data "aws_iam_instance_profile" "custom_worker_group_launch_template_iam_instanc
}

data "aws_partition" "current" {}

data "http" "wait_for_cluster" {
count = var.create_eks && var.manage_aws_auth ? 1 : 0
url = format("%s/healthz", aws_eks_cluster.this[0].endpoint)
ca_certificate = base64decode(coalescelist(aws_eks_cluster.this[*].certificate_authority[0].data, [""])[0])
timeout = 300

depends_on = [
aws_eks_cluster.this,
aws_security_group_rule.cluster_private_access,
]
}

0 comments on commit 1f22d24

Please sign in to comment.