From de1419b597f6db444146535a633b0e7a945bcd3d Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Fri, 20 Mar 2020 22:34:33 +0200 Subject: [PATCH] feat: Add interpreter option to `wait_for_cluster_cmd` (#795) Co-authored-by: Vasilyev, Viacheslav Co-authored-by: Thierno IB. BARRY --- README.md | 1 + cluster.tf | 3 ++- variables.tf | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1db97d7..e978504 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a | tags | A map of tags to add to all resources. | `map(string)` | `{}` | no | | vpc\_id | VPC where the cluster and workers will be deployed. | `string` | n/a | yes | | wait\_for\_cluster\_cmd | Custom local-exec command to execute for determining if the eks cluster is healthy. Cluster endpoint will be available as an environment variable called ENDPOINT | `string` | `"for i in `seq 1 60`; do wget --no-check-certificate -O - -q $ENDPOINT/healthz \u003e/dev/null \u0026\u0026 exit 0 \|\| true; sleep 5; done; echo TIMEOUT \u0026\u0026 exit 1"` | no | +| wait\_for\_cluster\_interpreter | Custom local-exec command line interpreter for the command to determining if the eks cluster is healthy. | `list(string)` |
[
"/bin/sh",
"-c"
]
| no | | worker\_additional\_security\_group\_ids | A list of additional security group ids to attach to worker instances | `list(string)` | `[]` | no | | worker\_ami\_name\_filter | Name filter for AWS EKS worker AMI. If not provided, the latest official AMI for the specified 'cluster\_version' is used. | `string` | `""` | no | | worker\_ami\_name\_filter\_windows | Name filter for AWS EKS Windows worker AMI. If not provided, the latest official AMI for the specified 'cluster\_version' is used. | `string` | `""` | no | diff --git a/cluster.tf b/cluster.tf index cd5e6cd..b3897c2 100644 --- a/cluster.tf +++ b/cluster.tf @@ -65,7 +65,8 @@ resource "null_resource" "wait_for_cluster" { ] provisioner "local-exec" { - command = var.wait_for_cluster_cmd + command = var.wait_for_cluster_cmd + interpreter = var.wait_for_cluster_interpreter environment = { ENDPOINT = aws_eks_cluster.this[0].endpoint } diff --git a/variables.tf b/variables.tf index 2bd5c6e..3d6f8fa 100644 --- a/variables.tf +++ b/variables.tf @@ -204,6 +204,12 @@ variable "wait_for_cluster_cmd" { default = "for i in `seq 1 60`; do wget --no-check-certificate -O - -q $ENDPOINT/healthz >/dev/null && exit 0 || true; sleep 5; done; echo TIMEOUT && exit 1" } +variable "wait_for_cluster_interpreter" { + description = "Custom local-exec command line interpreter for the command to determining if the eks cluster is healthy." + type = list(string) + default = ["/bin/sh", "-c"] +} + variable "cluster_create_security_group" { description = "Whether to create a security group for the cluster or attach the cluster to `cluster_security_group_id`." type = bool