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 + ] }