Skip to content

Commit

Permalink
Add ability to change local exec interpreter from variable. (cloudpos…
Browse files Browse the repository at this point in the history
…se#29)

* Add ability to change local exec interpreter

* Update README.md and terraform.md
  • Loading branch information
RobusGauli authored and aknysh committed Nov 6, 2019
1 parent a1a78a1 commit 3a3ed55
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ Available targets:
| endpoint_public_access | Indicates whether or not the Amazon EKS public API server endpoint is enabled. Default to AWS EKS resource and it is true | bool | `true` | no |
| kubeconfig_path | The path to `kubeconfig` file | string | `~/.kube/config` | no |
| kubernetes_version | Desired Kubernetes master version. If you do not specify a value, the latest available version is used | string | `1.14` | no |
| local_exec_interpreter | shell to use for local exec | string | `/bin/sh` | no |
| map_additional_aws_accounts | Additional AWS account numbers to add to `config-map-aws-auth` ConfigMap | list(string) | `<list>` | no |
| map_additional_iam_roles | Additional IAM roles to add to `config-map-aws-auth` ConfigMap | object | `<list>` | no |
| map_additional_iam_users | Additional IAM users to add to `config-map-aws-auth` ConfigMap | object | `<list>` | no |
Expand Down
3 changes: 2 additions & 1 deletion auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ resource "null_resource" "apply_configmap_auth" {
depends_on = [aws_eks_cluster.default, local_file.configmap_auth]

provisioner "local-exec" {
command = <<EOT
interpreter = [var.local_exec_interpreter, "-c"]
command = <<EOT
while [[ ! -e ${local.configmap_auth_file} ]] ; do sleep 1; done && \
aws eks update-kubeconfig --name=${local.cluster_name} --region=${var.region} --kubeconfig=${var.kubeconfig_path} && \
kubectl apply -f ${local.configmap_auth_file} --kubeconfig ${var.kubeconfig_path}
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| endpoint_public_access | Indicates whether or not the Amazon EKS public API server endpoint is enabled. Default to AWS EKS resource and it is true | bool | `true` | no |
| kubeconfig_path | The path to `kubeconfig` file | string | `~/.kube/config` | no |
| kubernetes_version | Desired Kubernetes master version. If you do not specify a value, the latest available version is used | string | `1.14` | no |
| local_exec_interpreter | shell to use for local exec | string | `/bin/sh` | no |
| map_additional_aws_accounts | Additional AWS account numbers to add to `config-map-aws-auth` ConfigMap | list(string) | `<list>` | no |
| map_additional_iam_roles | Additional IAM roles to add to `config-map-aws-auth` ConfigMap | object | `<list>` | no |
| map_additional_iam_users | Additional IAM users to add to `config-map-aws-auth` ConfigMap | object | `<list>` | no |
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,9 @@ variable "kubeconfig_path" {
default = "~/.kube/config"
description = "The path to `kubeconfig` file"
}

variable "local_exec_interpreter" {
type = string
default = "/bin/sh"
description = "shell to use for local exec"
}

0 comments on commit 3a3ed55

Please sign in to comment.