clean code by removing #

This commit is contained in:
2024-11-18 13:43:56 +00:00
parent 537300ad3b
commit 5e66177351
+7 -29
View File
@@ -12,12 +12,8 @@ provider "kubernetes" {
variable "kubernetes" {
type = map(object({
#service = string
# pvc_name = optional(string)
name = optional(string)
image = string
# mount_path = optional(string, "/mount")
# pvc_size = optional(string)
pvc = optional(map(object({
name = string
pvc_size = string
@@ -38,10 +34,6 @@ variable "kubernetes" {
requests-memory = "200Mi"
})
environment_variables = optional(map(string), { name = "value" })
# environment_variables = optional(list(object({
# name = string
# value = string
# })))
}))
}
@@ -122,6 +114,7 @@ resource "kubernetes_deployment_v1" "automatic" {
name = coalesce(each.value.namespace, each.key)
labels = {
app = each.key
deployment_method = "Terraform"
}
}
@@ -138,6 +131,7 @@ resource "kubernetes_deployment_v1" "automatic" {
metadata {
labels = {
app = each.key
deployment_method = "Terraform"
}
}
@@ -162,22 +156,6 @@ resource "kubernetes_deployment_v1" "automatic" {
}
}
#########################################
############# working but not goign through every arguments
# dynamic "env" {
# for_each = each.value.environment_variables != null ? [""] : []
# content {
# name = keys(each.value.environment_variables)[0]
# value = values(each.value.environment_variables)[0]
# }
# }
#######################################
@@ -226,13 +204,14 @@ resource "kubernetes_deployment_v1" "automatic" {
}
}
dynamic "volume" {
for_each = each.value.pvc != null ? [""] : []
# for_each = each.value.pvc_size != null ? [""] : []
for_each = each.value.pvc != null ? each.value.pvc : {}
content {
name = "${each.key}-volume"
name = "${volume.value.name}-pvc"
persistent_volume_claim {
claim_name = "${each.key}-pvc"
claim_name = "${volume.value.name}-pvc"
}
}
}
@@ -240,4 +219,3 @@ resource "kubernetes_deployment_v1" "automatic" {
}
}
}
}