From 9d52905c944545638d1bb1fe45a53e7084e83ce1 Mon Sep 17 00:00:00 2001 From: saibossai <129429285+saibossai@users.noreply.github.com> Date: Thu, 30 Mar 2023 15:38:41 -0400 Subject: [PATCH] Fix: namespace creation optional for csi-secret-store-provider-aws module Address the issue: https://github.com/aws-ia/terraform-aws-eks-blueprints/pull/1281#issuecomment-1370896054 introduced in the #1281 --- .../csi-secrets-store-provider-aws/main.tf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/kubernetes-addons/csi-secrets-store-provider-aws/main.tf b/modules/kubernetes-addons/csi-secrets-store-provider-aws/main.tf index 3af5f29910..16d763fe8d 100644 --- a/modules/kubernetes-addons/csi-secrets-store-provider-aws/main.tf +++ b/modules/kubernetes-addons/csi-secrets-store-provider-aws/main.tf @@ -4,6 +4,8 @@ locals { } resource "kubernetes_namespace_v1" "csi_secrets_store_provider_aws" { + count = local.namespace == "kube-system" ? 0 : 1 + metadata { name = local.namespace } @@ -19,7 +21,7 @@ module "helm_addon" { chart = local.name repository = "https://aws.github.io/eks-charts" version = "0.0.3" - namespace = kubernetes_namespace_v1.csi_secrets_store_provider_aws.metadata[0].name + namespace = local.namespace description = "A Helm chart to install the Secrets Store CSI Driver and the AWS Key Management Service Provider inside a Kubernetes cluster." }, var.helm_config @@ -27,4 +29,8 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops addon_context = var.addon_context + + depends_on = [ + kubernetes_namespace_v1.csi_secrets_store_provider_aws + ] }