From 164e48b6aa06e8d8dfa83e77e609bf5c089241a0 Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 26 Nov 2024 14:34:06 +0000 Subject: [PATCH] add module as database is good to go --- module.tf | 82 ++++++++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/module.tf b/module.tf index 8116bb3..011b6b1 100644 --- a/module.tf +++ b/module.tf @@ -367,18 +367,15 @@ resource "kubernetes_deployment_v1" "database-automatic" { } - - dynamic "volume_mount" { - for_each = each.value.pvc != null ? each.value.pvc : {} - content { - mount_path = volume_mount.value.mount_path - name = "${volume_mount.value.name}-pvc" - } + volume_mount { + mount_path = "/var/lib/postgresql/data" + name = "${each.key}-db-pvc" } + dynamic "env" { for_each = each.value.environment != null ? each.value.environment : {} content { @@ -402,50 +399,47 @@ resource "kubernetes_deployment_v1" "database-automatic" { } - resources { - limits = { - cpu = each.value.requirements.limits-cpu - memory = each.value.requirements.limits-memory - } - requests = { - cpu = each.value.requirements.requests-cpu - memory = each.value.requirements.requests-memory - } - } + # resources { + # limits = { + # cpu = each.value.requirements.limits-cpu + # memory = each.value.requirements.limits-memory + # } + # requests = { + # cpu = each.value.requirements.requests-cpu + # memory = each.value.requirements.requests-memory + # } + # } - dynamic "liveness_probe" { - for_each = each.value.liveness_tcp_socket != null || each.value.liveness_http_get != null ? [""] : [] - content { - dynamic "tcp_socket" { - for_each = each.value.liveness_tcp_socket != null ? [""] : [] - content { - port = each.value.liveness_tcp_socket - } - } + # dynamic "liveness_probe" { + # for_each = each.value.liveness_tcp_socket != null || each.value.liveness_http_get != null ? [""] : [] + # content { + # dynamic "tcp_socket" { + # for_each = each.value.liveness_tcp_socket != null ? [""] : [] + # content { + # port = each.value.liveness_tcp_socket + # } + # } - dynamic "http_get" { - for_each = each.value.liveness_http_get != null ? [""] : [] - content { - port = each.value.liveness_http_get - path = coalesce(each.value.liveness_http_get_path, "/") - } - } + # dynamic "http_get" { + # for_each = each.value.liveness_http_get != null ? [""] : [] + # content { + # port = each.value.liveness_http_get + # path = coalesce(each.value.liveness_http_get_path, "/") + # } + # } - initial_delay_seconds = 3 - period_seconds = 3 - } - } + # initial_delay_seconds = 3 + # period_seconds = 3 + # } + # } } - dynamic "volume" { - for_each = each.value.pvc != null ? each.value.pvc : {} - content { - name = "${volume.value.name}-pvc" - persistent_volume_claim { - claim_name = "${volume.value.name}-pvc" - } + volume { + name = "${each.key}-db-pvc" + persistent_volume_claim { + claim_name = "${each.key}-db-pvc" } }