clean code by removing #
This commit is contained in:
@@ -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
|
||||
# })))
|
||||
}))
|
||||
|
||||
}
|
||||
@@ -121,7 +113,8 @@ resource "kubernetes_deployment_v1" "automatic" {
|
||||
namespace = coalesce(each.value.namespace, each.key)
|
||||
name = coalesce(each.value.namespace, each.key)
|
||||
labels = {
|
||||
app = each.key
|
||||
app = each.key
|
||||
deployment_method = "Terraform"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +130,8 @@ resource "kubernetes_deployment_v1" "automatic" {
|
||||
template {
|
||||
metadata {
|
||||
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" {
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user