diff --git a/.gitignore b/.gitignore index e787fbf..8382e2a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ kubeconfig config-map-aws-auth.yaml eks-admin-cluster-role-binding.yaml eks-admin-service-account.yaml +.idea/ diff --git a/README.md b/README.md index 90e4dec..652b778 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a | kubeconfig_aws_authenticator_command | Command to use to to fetch AWS EKS credentials | string | `heptio-authenticator-aws` | no | | kubeconfig_aws_authenticator_env_variables | Environment variables that should be used when executing the authenticator i.e. { AWS_PROFILE = "eks"} | map | `` | no | | kubeconfig_name | Override the default name used for items kubeconfig. | string | `` | no | -| manage_aws_auth | Whether to write and apply the aws-auth configmap file | string | `true` | no | +| manage_aws_auth | Whether to write and apply the aws-auth configmap file. | string | `true` | no | | map_accounts | Additional AWS account numbers to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `` | no | | map_roles | Additional IAM roles to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `` | no | | map_users | Additional IAM users to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `` | no | @@ -114,7 +114,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a | worker_sg_ingress_from_port | Minimum port number from which pods will accept communication. Must be changed to a lower value if some pods in your cluster will expose a port lower than 1025 (e.g. 22, 80, or 443). | string | `1025` | no | | workers_group_defaults | Default values for target groups as defined by the list of maps. | map | `` | no | | workstation_cidr | Override the default ingress rule that allows communication with the EKS cluster API. If not given, will use current IP/32. | string | `` | no | -| write_kubeconfig | Whether to write a kubeconfig file containing the cluster configuration | string | `true` | no | +| write_kubeconfig | Whether to write a kubeconfig file containing the cluster configuration. | string | `true` | no | ## Outputs diff --git a/aws_auth.tf b/aws_auth.tf index ec32361..10edceb 100644 --- a/aws_auth.tf +++ b/aws_auth.tf @@ -1,17 +1,16 @@ resource "local_file" "config_map_aws_auth" { content = "${data.template_file.config_map_aws_auth.rendered}" filename = "${var.config_output_path}/config-map-aws-auth_${var.cluster_name}.yaml" - count = "${var.configure_kubectl_session ? 1 : 0}" + count = "${var.manage_aws_auth ? 1 : 0}" } -resource "null_resource" "configure_kubectl" { +resource "null_resource" "update_config_map_aws_auth" { provisioner "local-exec" { command = "kubectl apply -f ${var.config_output_path}/config-map-aws-auth_${var.cluster_name}.yaml --kubeconfig ${var.config_output_path}/kubeconfig_${var.cluster_name}" } triggers { config_map_rendered = "${data.template_file.config_map_aws_auth.rendered}" - kubeconfig_rendered = "${data.template_file.kubeconfig.rendered}" } count = "${var.configure_kubectl_session ? 1 : 0}" diff --git a/variables.tf b/variables.tf index 0bc65dc..d5c4b4a 100644 --- a/variables.tf +++ b/variables.tf @@ -23,12 +23,12 @@ variable "config_output_path" { } variable "write_kubeconfig" { - description = "Whether to write a kubeconfig file containing the cluster configuration" + description = "Whether to write a kubeconfig file containing the cluster configuration." default = true } variable "manage_aws_auth" { - description = "Whether to write and apply the aws-auth configmap file" + description = "Whether to write and apply the aws-auth configmap file." default = true }