mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-25 02:41:03 +01:00
feat: Replace the local-exec script with a http datasource for waiting cluster (#1339)
NOTES: Using the [terraform-aws-modules/http](https://registry.terraform.io/providers/terraform-aws-modules/http/latest) provider is a more platform agnostic way to wait for the cluster availability than using a local-exec. With this change we're able to provision EKS clusters and manage the `aws_auth` configmap while still using the `hashicorp/tfc-agent` docker image.
This commit is contained in:
committed by
GitHub
parent
781f673295
commit
e3bf48bba2
19
cluster.tf
19
cluster.tf
@@ -64,21 +64,10 @@ resource "aws_security_group_rule" "cluster_private_access" {
|
||||
}
|
||||
|
||||
|
||||
resource "null_resource" "wait_for_cluster" {
|
||||
count = var.create_eks && var.manage_aws_auth ? 1 : 0
|
||||
|
||||
depends_on = [
|
||||
aws_eks_cluster.this,
|
||||
aws_security_group_rule.cluster_private_access,
|
||||
]
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = var.wait_for_cluster_cmd
|
||||
interpreter = var.wait_for_cluster_interpreter
|
||||
environment = {
|
||||
ENDPOINT = aws_eks_cluster.this[0].endpoint
|
||||
}
|
||||
}
|
||||
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])
|
||||
}
|
||||
|
||||
resource "aws_security_group" "cluster" {
|
||||
|
||||
Reference in New Issue
Block a user