From 34cf66b47d23772cea304cba9a5ecf50a9080cea Mon Sep 17 00:00:00 2001 From: Steve Davids Date: Fri, 29 Jun 2018 20:49:40 -0400 Subject: [PATCH] Fixed terraform formatting --- data.tf | 16 +++++++++------- variables.tf | 10 +++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/data.tf b/data.tf index 76ebcad..c47075f 100644 --- a/data.tf +++ b/data.tf @@ -48,12 +48,12 @@ data "template_file" "kubeconfig" { template = "${file("${path.module}/templates/kubeconfig.tpl")}" vars { - cluster_name = "${var.cluster_name}" - endpoint = "${aws_eks_cluster.this.endpoint}" - region = "${data.aws_region.current.name}" - cluster_auth_base64 = "${aws_eks_cluster.this.certificate_authority.0.data}" - context_name = "${var.kubeconfig_context_name}" - user_name = "${var.kubeconfig_user_name}" + cluster_name = "${var.cluster_name}" + endpoint = "${aws_eks_cluster.this.endpoint}" + region = "${data.aws_region.current.name}" + cluster_auth_base64 = "${aws_eks_cluster.this.certificate_authority.0.data}" + context_name = "${var.kubeconfig_context_name}" + user_name = "${var.kubeconfig_user_name}" aws_authenticator_command = "${var.kubeconfig_aws_authenticator_command}" aws_authenticator_additional_args = "${length(var.kubeconfig_aws_authenticator_additional_args) > 0 ? " - ${join("\n - ", var.kubeconfig_aws_authenticator_additional_args)}" : "" }" aws_authenticator_env_variables = "${length(var.kubeconfig_aws_authenticator_env_variables) > 0 ? " env:\n${join("\n", data.template_file.aws_authenticator_env_variables.*.rendered)}" : ""}" @@ -65,10 +65,12 @@ data "template_file" "aws_authenticator_env_variables" { - name: $${key} value: $${value} EOF + count = "${length(var.kubeconfig_aws_authenticator_env_variables)}" + vars { value = "${element(values(var.kubeconfig_aws_authenticator_env_variables), count.index)}" - key = "${element(keys(var.kubeconfig_aws_authenticator_env_variables), count.index)}" + key = "${element(keys(var.kubeconfig_aws_authenticator_env_variables), count.index)}" } } diff --git a/variables.tf b/variables.tf index b8a9ee5..b8a3320 100644 --- a/variables.tf +++ b/variables.tf @@ -76,25 +76,25 @@ variable "worker_sg_ingress_from_port" { variable "kubeconfig_context_name" { description = "Name of the kubeconfig context." - default = "aws" + default = "aws" } variable "kubeconfig_user_name" { description = "Name of the kubeconfig user." - default = "aws" + default = "aws" } variable "kubeconfig_aws_authenticator_command" { description = "Command to use to to fetch AWS EKS credentials" - default = "heptio-authenticator-aws" + default = "heptio-authenticator-aws" } variable "kubeconfig_aws_authenticator_additional_args" { description = "Any additional arguments to pass to the authenticator such as the role to assume [\"-r\", \"MyEksRole\"]" - default = [] + default = [] } variable "kubeconfig_aws_authenticator_env_variables" { description = "Environment variables that should be used when executing the authenticator i.e. { AWS_PROFILE = \"eks\"}" - default = {} + default = {} }