locals { pv_name = "pv-p9hostpath-${var.name}" host_path = "/mnt/datastore/${var.name}" } resource "kubernetes_persistent_volume" "this" { metadata { name = local.pv_name } spec { capacity = { storage = var.volume_storage_capacity } access_modes = ["ReadWriteMany"] persistent_volume_source { host_path { path = local.host_path } } } } resource "kubernetes_persistent_volume_claim" "this" { metadata { name = var.name namespace = var.namespace } spec { access_modes = ["ReadWriteMany"] resources { requests = { storage = var.volume_storage_capacity } } volume_name = kubernetes_persistent_volume.this.metadata.0.name } }