From b69c8fb7596de59aa69fee020f8941ec6618f6b4 Mon Sep 17 00:00:00 2001 From: Mary Hayes Date: Wed, 20 Nov 2019 06:23:56 -0600 Subject: [PATCH] Run aws-auth Update Commands in Sequence and not Parallel (#592) * Run aws-auth Update Commands in Sequence and not Parallel * Update changelog --- CHANGELOG.md | 2 ++ aws_auth.tf | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f045b..35a7a40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ project adheres to [Semantic Versioning](http://semver.org/). ### Changed - Updated instance_profile_names and instance_profile_arns outputs to also consider launch template as well as asg (by @ankitwal) +- Updated application of `aws-auth` configmap to create `kube_config.yaml` and `aws_auth_configmap.yaml` in sequence (and not parallel) to `kubectl apply` (by @knittingdev) +- Exit with error code when `aws-auth` configmap is unable to be updated (by @knittingdev) - Fix deprecated interpolation-only expression (by @angelabad) - Fix broken terraform plan/apply on a cluster < 1.14 (by @hodduc) diff --git a/aws_auth.tf b/aws_auth.tf index bd32211..ebec035 100644 --- a/aws_auth.tf +++ b/aws_auth.tf @@ -12,13 +12,16 @@ resource "null_resource" "update_config_map_aws_auth" { working_dir = path.module command = < kube_config.yaml & \ -echo "${null_resource.update_config_map_aws_auth[0].triggers.config_map_rendered}" > aws_auth_configmap.yaml & \ -kubectl apply -f aws_auth_configmap.yaml --kubeconfig kube_config.yaml && break || \ +echo "${null_resource.update_config_map_aws_auth[0].triggers.kube_config_map_rendered}" > kube_config.yaml && \ +echo "${null_resource.update_config_map_aws_auth[0].triggers.config_map_rendered}" > aws_auth_configmap.yaml && \ +kubectl apply -f aws_auth_configmap.yaml --kubeconfig kube_config.yaml && \ +completed_apply=1 && break || \ sleep 10; \ done; \ rm aws_auth_configmap.yaml kube_config.yaml; +if [ "$completed_apply" = "0" ]; then exit 1; fi; EOS