another try for the hostpath

This commit is contained in:
pierre geeraert
2026-10-11 12:42:29 +01:00
parent 6d9b7d792f
commit a0cf0cebe4
4 changed files with 11 additions and 136 deletions
+7 -38
View File
@@ -22,15 +22,15 @@ variable "kubernetes" {
docker = optional(bool)
image = string
pvc = optional(map(object({
name = string
pvc = optional(bool, false)
config_map = optional(bool, false)
secret = optional(bool, false)
host_path = optional(string)
pvc_size = optional(string)
name = string
config_map = optional(bool, false)
secret = optional(bool, false)
host_path = optional(bool, false)
host_folderpath = optional(string)
storage_class_name = optional(string, "nfs-storage-intelligent")
annotations_fileType = optional(string)
existing_pvc = optional(bool, false)
mount_path = string
sub_path = optional(string)
})))
@@ -81,38 +81,7 @@ variable "shunt_docker" {
}
locals {
pvc_list = flatten([
for key, value in var.kubernetes : [
for index, pvc in value.pvc : {
key = "${coalesce(value.namespace, value.connected_namespace, key)}/${pvc.name}"
index = index
pvc = pvc.pvc
name = pvc.name
pvc_size = pvc.pvc_size
mount_path = pvc.mount_path
storage_class_name = pvc.storage_class_name
annotations_fileType = pvc.annotations_fileType
existing_pvc = pvc.existing_pvc
sub_path = pvc.sub_path
namespace = coalesce(value.namespace, value.connected_namespace, key)
}] if value.enabled == true && value.pvc != null && value.docker != true
])
# group duplicates instead of throwing an error
pvc_map_grouped = {
for p in local.pvc_list :
p.key => p...
}
# keep only one PVC per key (take the first)
pvc_map = {
for k, list in local.pvc_map_grouped :
k => list[0]
}
pvc_details = values(local.pvc_map)
}
locals {
env_details = flatten([