another try for the hostpath
This commit is contained in:
+7
-38
@@ -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([
|
||||
|
||||
Reference in New Issue
Block a user