From ae417217ba8e7eec957ec6672fa1971163f3e443 Mon Sep 17 00:00:00 2001 From: Carlos Santana Date: Thu, 30 Mar 2023 12:19:02 -0400 Subject: [PATCH] fix: Adds namespace creation dependency for role binding resource (#9) Signed-off-by: Carlos Santana --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index fc39e75..c02f222 100644 --- a/main.tf +++ b/main.tf @@ -346,7 +346,7 @@ resource "kubernetes_role_binding_v1" "this" { metadata { name = "${coalesce(var.role_name, var.name)}-${each.key}" - namespace = each.key + namespace = try(each.value.create, true) ? kubernetes_namespace_v1.this[each.key].metadata[0].name : each.key annotations = var.annotations labels = var.labels } @@ -364,7 +364,7 @@ resource "kubernetes_role_binding_v1" "this" { kind = "Group" name = var.name api_group = "rbac.authorization.k8s.io" - namespace = each.key + namespace = try(each.value.create, true) ? kubernetes_namespace_v1.this[each.key].metadata[0].name : each.key } }