From 6fc1f848e819230d7464a224c6d8693da4d078b7 Mon Sep 17 00:00:00 2001 From: Andriy Knysh Date: Fri, 17 Jan 2020 10:36:35 -0500 Subject: [PATCH] Fix variables. Add waiting for the cluster to be ready (#48) * Fix variables. Add waiting for the cluster to be ready * Fix variables. Add waiting for the cluster to be ready * Fix variables. Add waiting for the cluster to be ready --- LICENSE | 2 +- README.md | 2 +- auth.tf | 1 + docs/terraform.md | 2 +- examples/complete/variables.tf | 4 ++-- variables.tf | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/LICENSE b/LICENSE index eb114f25..65d68ec1 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2019 Cloud Posse, LLC + Copyright 2018-2020 Cloud Posse, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 6b43c268..7254aa69 100644 --- a/README.md +++ b/README.md @@ -375,7 +375,7 @@ Available targets: |------|-------------|:----:|:-----:|:-----:| | allowed_cidr_blocks | List of CIDR blocks to be allowed to connect to the EKS cluster | list(string) | `` | no | | allowed_security_groups | List of Security Group IDs to be allowed to connect to the EKS cluster | list(string) | `` | no | -| 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 | +| apply_config_map_aws_auth | Whether to execute `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 | | aws_cli_assume_role_arn | IAM Role ARN for AWS CLI to assume before calling `aws eks` to update `kubeconfig` | string | `` | no | diff --git a/auth.tf b/auth.tf index d925ac55..ec940951 100644 --- a/auth.tf +++ b/auth.tf @@ -137,6 +137,7 @@ resource "null_resource" "apply_configmap_auth" { echo 'Applying Auth ConfigMap with kubectl...' aws eks update-kubeconfig --name=${local.cluster_name} --region=${var.region} --kubeconfig=${var.kubeconfig_path} ${var.aws_eks_update_kubeconfig_additional_arguments} + until kubectl version --kubeconfig ${var.kubeconfig_path} >/dev/null; do sleep 5; done kubectl version --kubeconfig ${var.kubeconfig_path} kubectl apply -f ${local.configmap_auth_file} --kubeconfig ${var.kubeconfig_path} echo 'Applied Auth ConfigMap with kubectl' diff --git a/docs/terraform.md b/docs/terraform.md index a0cda930..33227c58 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -4,7 +4,7 @@ |------|-------------|:----:|:-----:|:-----:| | allowed_cidr_blocks | List of CIDR blocks to be allowed to connect to the EKS cluster | list(string) | `` | no | | allowed_security_groups | List of Security Group IDs to be allowed to connect to the EKS cluster | list(string) | `` | no | -| 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 | +| apply_config_map_aws_auth | Whether to execute `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 | | aws_cli_assume_role_arn | IAM Role ARN for AWS CLI to assume before calling `aws eks` to update `kubeconfig` | string | `` | no | diff --git a/examples/complete/variables.tf b/examples/complete/variables.tf index 83750da6..dd617343 100644 --- a/examples/complete/variables.tf +++ b/examples/complete/variables.tf @@ -53,7 +53,7 @@ variable "kubernetes_version" { } variable "health_check_type" { - type = "string" + type = string description = "Controls how health checking is done. Valid values are `EC2` or `ELB`" } @@ -125,7 +125,7 @@ variable "map_additional_iam_users" { variable "oidc_provider_enabled" { type = bool default = false - description = "Create an IAM OIDC identity provider for the cluster, then you can create IAM roles to associate with a service account in the cluster, instead of using kiam or kube2iam. For more information, see https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html" + description = "Create an IAM OIDC identity provider for the cluster, then you can create IAM roles to associate with a service account in the cluster, instead of using `kiam` or `kube2iam`. For more information, see https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html" } variable "kubeconfig_path" { diff --git a/variables.tf b/variables.tf index cf5aff56..0602fa3e 100644 --- a/variables.tf +++ b/variables.tf @@ -122,7 +122,7 @@ variable "enabled_cluster_log_types" { variable "apply_config_map_aws_auth" { type = bool default = true - description = "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" + description = "Whether to execute `kubectl apply` to apply the ConfigMap to allow worker nodes to join the EKS cluster" } variable "map_additional_aws_accounts" {