filter to not create the pvc if different than pointing to a pvc

This commit is contained in:
2024-12-11 22:15:01 +00:00
parent a15d0e8148
commit 87237f6b68
+2 -1
View File
@@ -59,6 +59,7 @@ locals {
for key, value in var.kubernetes : [ for key, value in var.kubernetes : [
for index, pvc in value.pvc : { for index, pvc in value.pvc : {
index = index index = index
pvc = pvc.pvc
name = pvc.name name = pvc.name
pvc_size = pvc.pvc_size pvc_size = pvc.pvc_size
mount_path = pvc.mount_path mount_path = pvc.mount_path
@@ -129,7 +130,7 @@ resource "kubernetes_namespace" "automatic" {
#} #}
resource "kubernetes_persistent_volume_claim" "automatic-pvc" { resource "kubernetes_persistent_volume_claim" "automatic-pvc" {
for_each = { for key, value in local.pvc_details : "${value.index}" => merge(value, { mew_key = value.index }) } for_each = { for key, value in local.pvc_details : "${value.index}" => merge(value, { mew_key = value.index }) if value.pvc }
metadata { metadata {
namespace = each.value.namespace namespace = each.value.namespace
name = "${each.value.name}-pvc" name = "${each.value.name}-pvc"