Use terraform http data source to wait for cluster coming up

Neat example of how we can use terraform http data source to wait for our kubernetes cluster to come up with a healthy state (shamelessly taken from some github repo)

 1data "http" "wait_for_cluster" {
 2  count = var.create_eks && var.manage_aws_auth ? 1 : 0
 3
 4  url            = format("%s/healthz", aws_eks_cluster.this[0].endpoint)
 5  ca_certificate = base64decode(local.cluster_auth_base64)
 6  timeout        = var.wait_for_cluster_timeout
 7
 8  depends_on = [
 9    aws_eks_cluster.this,
10    aws_security_group_rule.cluster_private_access_sg_source,
11    aws_security_group_rule.cluster_private_access_cidrs_source,
12  ]
13}

Copyright

Comments