Skip to content

Commit d79c8ab

Browse files
shauncmax-rocket-internet
authored andcommitted
Wait cluster responsive (#639)
* wait for cluster to respond before creating auth config map * adds changelog entry * fixup tf format * fixup kubernetes required version * fixup missing local for kubeconfig_filename * combine wait for cluster into provisioner on cluster; change status check to /healthz on endpoint * fix: make kubernetes provider version more permissive
1 parent c17d17e commit d79c8ab

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
99

1010
## [[v8.?.?](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v7.0.0...HEAD)] - 2019-??-??]
1111

12+
- Wait for cluster to respond to kubectl before applying auth map_config (@shaunc)
1213
- Added flag `create_eks` to conditionally create resources (by @syst0m / @tbeijen)
1314
- Support for AWS EKS Managed Node Groups. (by @wmorgan6796)
1415
- Added a if check on `aws-auth` configmap when `map_roles` is empty (by @shanmugakarna)

aws_auth.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ data "template_file" "node_group_arns" {
5353
}
5454

5555
resource "kubernetes_config_map" "aws_auth" {
56-
count = var.create_eks && var.manage_aws_auth ? 1 : 0
56+
depends_on = [aws_eks_cluster.this]
57+
count = var.create_eks && var.manage_aws_auth ? 1 : 0
5758

5859
metadata {
5960
name = "aws-auth"

cluster.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ resource "aws_eks_cluster" "this" {
3131
aws_iam_role_policy_attachment.cluster_AmazonEKSServicePolicy,
3232
aws_cloudwatch_log_group.this
3333
]
34+
provisioner "local-exec" {
35+
command = <<EOT
36+
until curl -k ${aws_eks_cluster.this[0].endpoint}/healthz >/dev/null; do sleep 4; done
37+
EOT
38+
}
3439
}
3540

3641
resource "aws_security_group" "cluster" {

versions.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ terraform {
22
required_version = ">= 0.12.9"
33

44
required_providers {
5-
aws = ">= 2.38.0"
6-
local = ">= 1.2"
7-
null = ">= 2.1"
8-
template = ">= 2.1"
9-
random = ">= 2.1"
5+
aws = ">= 2.38.0"
6+
local = ">= 1.2"
7+
null = ">= 2.1"
8+
template = ">= 2.1"
9+
random = ">= 2.1"
10+
kubernetes = ">= 1.6.2"
1011
}
1112
}

0 commit comments

Comments
 (0)