clean code by removing #

This commit is contained in:
2024-11-18 13:43:56 +00:00
parent 537300ad3b
commit 5e66177351
+9 -31
View File
@@ -12,12 +12,8 @@ provider "kubernetes" {
variable "kubernetes" { variable "kubernetes" {
type = map(object({ type = map(object({
#service = string
# pvc_name = optional(string)
name = optional(string) name = optional(string)
image = string image = string
# mount_path = optional(string, "/mount")
# pvc_size = optional(string)
pvc = optional(map(object({ pvc = optional(map(object({
name = string name = string
pvc_size = string pvc_size = string
@@ -38,10 +34,6 @@ variable "kubernetes" {
requests-memory = "200Mi" requests-memory = "200Mi"
}) })
environment_variables = optional(map(string), { name = "value" }) environment_variables = optional(map(string), { name = "value" })
# environment_variables = optional(list(object({
# name = string
# value = string
# })))
})) }))
} }
@@ -121,7 +113,8 @@ resource "kubernetes_deployment_v1" "automatic" {
namespace = coalesce(each.value.namespace, each.key) namespace = coalesce(each.value.namespace, each.key)
name = coalesce(each.value.namespace, each.key) name = coalesce(each.value.namespace, each.key)
labels = { labels = {
app = each.key app = each.key
deployment_method = "Terraform"
} }
} }
@@ -137,7 +130,8 @@ resource "kubernetes_deployment_v1" "automatic" {
template { template {
metadata { metadata {
labels = { labels = {
app = each.key 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,17 +204,17 @@ resource "kubernetes_deployment_v1" "automatic" {
} }
} }
dynamic "volume" { dynamic "volume" {
for_each = each.value.pvc != null ? [""] : [] for_each = each.value.pvc != null ? each.value.pvc : {}
# for_each = each.value.pvc_size != null ? [""] : []
content { content {
name = "${each.key}-volume" name = "${volume.value.name}-pvc"
persistent_volume_claim { persistent_volume_claim {
claim_name = "${each.key}-pvc" claim_name = "${volume.value.name}-pvc"
} }
} }
} }
} }
} }
} }