filter to not create the pvc if different than pointing to a pvc
This commit is contained in:
@@ -13,7 +13,7 @@ variable "kubernetes" {
|
||||
image = string
|
||||
pvc = optional(map(object({
|
||||
name = string
|
||||
pvc = optional(bool,false)
|
||||
pvc = optional(bool, false)
|
||||
config_map = optional(bool, false)
|
||||
host_path = optional(string)
|
||||
pvc_size = optional(string)
|
||||
@@ -59,6 +59,7 @@ locals {
|
||||
for key, value in var.kubernetes : [
|
||||
for index, pvc in value.pvc : {
|
||||
index = index
|
||||
pvc = pvc.pvc
|
||||
name = pvc.name
|
||||
pvc_size = pvc.pvc_size
|
||||
mount_path = pvc.mount_path
|
||||
@@ -129,7 +130,7 @@ resource "kubernetes_namespace" "automatic" {
|
||||
#}
|
||||
|
||||
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 {
|
||||
namespace = each.value.namespace
|
||||
name = "${each.value.name}-pvc"
|
||||
|
||||
Reference in New Issue
Block a user