clsing brackets
This commit is contained in:
+14
-13
@@ -28,12 +28,12 @@ variable "storage_path" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "kubernetes_deployment_v1" "redis-automatic" {
|
resource "kubernetes_deployment_v1" "redis-automatic" {
|
||||||
for_each = { for key, value in var.kubernetes_input : key => value if value.redis != null && value.enabled == true }
|
for_each = {for key, value in var.kubernetes_input : key => value if value.redis != null && value.enabled == true}
|
||||||
|
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
namespace = coalesce(each.value.namespace, each.value.connected_namespace, each.key)
|
namespace = coalesce(each.value.namespace, each.value.connected_namespace, each.key)
|
||||||
name = "${coalesce(each.value.name, each.key)}-redis"
|
name = "${coalesce(each.value.name, each.key)}-redis"
|
||||||
labels = {
|
labels = {
|
||||||
app = each.key
|
app = each.key
|
||||||
deployment_method = "Terraform"
|
deployment_method = "Terraform"
|
||||||
@@ -62,7 +62,7 @@ resource "kubernetes_deployment_v1" "redis-automatic" {
|
|||||||
spec {
|
spec {
|
||||||
container {
|
container {
|
||||||
image = try(each.value.redis.image, "docker.io/library/redis:7")
|
image = try(each.value.redis.image, "docker.io/library/redis:7")
|
||||||
name = "${coalesce(each.value.name, each.key)}-redis"
|
name = "${coalesce(each.value.name, each.key)}-redis"
|
||||||
port {
|
port {
|
||||||
|
|
||||||
container_port = 6379
|
container_port = 6379
|
||||||
@@ -76,9 +76,6 @@ resource "kubernetes_deployment_v1" "redis-automatic" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dynamic "env" {
|
dynamic "env" {
|
||||||
for_each = each.value.environment != null ? each.value.environment : {}
|
for_each = each.value.environment != null ? each.value.environment : {}
|
||||||
content {
|
content {
|
||||||
@@ -92,22 +89,26 @@ resource "kubernetes_deployment_v1" "redis-automatic" {
|
|||||||
content {
|
content {
|
||||||
name = env.value.value_from.secret_key_ref.name
|
name = env.value.value_from.secret_key_ref.name
|
||||||
key = env.value.value_from.secret_key_ref.key
|
key = env.value.value_from.secret_key_ref.key
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
volume {
|
volume {
|
||||||
name = "${each.key}-redis-volume"
|
name = "${each.key}-redis-volume"
|
||||||
host_path {
|
host_path {
|
||||||
path = try(each.value.redis.host_path, join("/", [var.storage_path.main_storage, coalesce(each.value.namespace, each.value.connected_namespace, each.key), join("-", [each.key, "redis"])]))
|
path = try(each.value.redis.host_path, join("/", [
|
||||||
|
var.storage_path.main_storage, coalesce(each.value.namespace, each.value.connected_namespace, each.key),
|
||||||
|
join("-", [each.key, "redis"])
|
||||||
|
]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user