enable variable storageclass
This commit is contained in:
@@ -12,12 +12,13 @@ variable "kubernetes" {
|
||||
name = optional(string)
|
||||
image = string
|
||||
pvc = optional(map(object({
|
||||
name = string
|
||||
pvc = optional(bool, false)
|
||||
config_map = optional(bool, false)
|
||||
host_path = optional(string)
|
||||
pvc_size = optional(string)
|
||||
mount_path = string
|
||||
name = string
|
||||
pvc = optional(bool, false)
|
||||
config_map = optional(bool, false)
|
||||
host_path = optional(string)
|
||||
pvc_size = optional(string)
|
||||
storage_class_name = optional(string, "nfs-storage-intelligent")
|
||||
mount_path = string
|
||||
})))
|
||||
environment = optional(map(object({
|
||||
name = optional(string)
|
||||
@@ -58,12 +59,13 @@ locals {
|
||||
pvc_details = flatten([
|
||||
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
|
||||
namespace = coalesce(value.namespace, key)
|
||||
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
|
||||
namespace = coalesce(value.namespace, key)
|
||||
}] if value.enabled == true && value.pvc != null
|
||||
])
|
||||
}
|
||||
@@ -131,7 +133,7 @@ resource "kubernetes_persistent_volume_claim" "automatic-pvc" {
|
||||
}
|
||||
spec {
|
||||
access_modes = ["ReadWriteMany"]
|
||||
storage_class_name = "nfs-storage-intelligent"
|
||||
storage_class_name = each.value.storage_class_name
|
||||
resources {
|
||||
requests = {
|
||||
storage = each.value.pvc_size
|
||||
|
||||
Reference in New Issue
Block a user