From 043b93eb5268c8a0fcd116f6ae753496e5a1f8cf Mon Sep 17 00:00:00 2001 From: Robus Gauli Date: Thu, 7 Nov 2019 21:51:12 +0545 Subject: [PATCH] Add configmap template and file as a variable to module (#31) * Add `confgimap_auth_template_file` and `configmap_auth_file` as a variable * Update terraform.md and README.md --- README.md | 2 ++ auth.tf | 4 ++-- docs/terraform.md | 2 ++ variables.tf | 12 ++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 623d361a..ef64efb3 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,8 @@ Available targets: | apply_config_map_aws_auth | Whether to generate local files from `kubeconfig` and `config-map-aws-auth` templates and perform `kubectl apply` to apply the ConfigMap to allow worker nodes to join the EKS cluster | bool | `true` | no | | associate_public_ip_address | Associate a public IP address with an instance in a VPC | bool | `true` | no | | attributes | Additional attributes (e.g. `1`) | list(string) | `` | no | +| configmap_auth_file | Path to `configmap_auth_file` | string | `` | no | +| configmap_auth_template_file | Path to `config_auth_template_file` | string | `` | no | | delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | | enabled | Whether to create the resources. Set to `false` to prevent the module from creating any resources | bool | `true` | no | | enabled_cluster_log_types | A list of the desired control plane logging to enable. For more information, see https://docs.aws.amazon.com/en_us/eks/latest/userguide/control-plane-logs.html. Possible values [`api`, `audit`, `authenticator`, `controllerManager`, `scheduler`] | list(string) | `` | no | diff --git a/auth.tf b/auth.tf index 94ff0ab8..39a1cb36 100644 --- a/auth.tf +++ b/auth.tf @@ -27,8 +27,8 @@ locals { certificate_authority_data_map = local.certificate_authority_data_list_internal[0] certificate_authority_data = local.certificate_authority_data_map["data"] - configmap_auth_template_file = join("/", [path.module, "configmap-auth.yaml.tpl"]) - configmap_auth_file = join("/", [path.module, "configmap-auth.yaml"]) + configmap_auth_template_file = var.configmap_auth_template_file == "" ? join("/", [path.module, "configmap-auth.yaml.tpl"]) : var.configmap_auth_template_file + configmap_auth_file = var.configmap_auth_file == "" ? join("/", [path.module, "configmap-auth.yaml"]) : var.configmap_auth_file cluster_name = join("", aws_eks_cluster.default.*.id) diff --git a/docs/terraform.md b/docs/terraform.md index b25db342..7557be7b 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -7,6 +7,8 @@ | apply_config_map_aws_auth | Whether to generate local files from `kubeconfig` and `config-map-aws-auth` templates and perform `kubectl apply` to apply the ConfigMap to allow worker nodes to join the EKS cluster | bool | `true` | no | | associate_public_ip_address | Associate a public IP address with an instance in a VPC | bool | `true` | no | | attributes | Additional attributes (e.g. `1`) | list(string) | `` | no | +| configmap_auth_file | Path to `configmap_auth_file` | string | `` | no | +| configmap_auth_template_file | Path to `config_auth_template_file` | string | `` | no | | delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | | enabled | Whether to create the resources. Set to `false` to prevent the module from creating any resources | bool | `true` | no | | enabled_cluster_log_types | A list of the desired control plane logging to enable. For more information, see https://docs.aws.amazon.com/en_us/eks/latest/userguide/control-plane-logs.html. Possible values [`api`, `audit`, `authenticator`, `controllerManager`, `scheduler`] | list(string) | `` | no | diff --git a/variables.tf b/variables.tf index 91736193..ee99443a 100644 --- a/variables.tf +++ b/variables.tf @@ -153,3 +153,15 @@ variable "local_exec_interpreter" { default = "/bin/sh" description = "shell to use for local exec" } + +variable "configmap_auth_template_file" { + type = string + default = "" + description = "Path to `config_auth_template_file`" +} + +variable "configmap_auth_file" { + type = string + default = "" + description = "Path to `configmap_auth_file`" +}