From ec07e1e0bab58ae2ce48ed825eb8a5efe3d04931 Mon Sep 17 00:00:00 2001 From: Matteo Vitali Date: Mon, 11 Mar 2024 17:09:03 +0100 Subject: [PATCH] Fix traefik redirects service port --- .../environment/modules/kubernetes/routing/main.tf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/routing/main.tf b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/routing/main.tf index 87fa0b6..b58603a 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/routing/main.tf +++ b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/routing/main.tf @@ -26,6 +26,8 @@ locals { tls_enabled = local.manual_certificate_enabled || local.letsencrypt_enabled tls_secret_name = local.tls_enabled ? "tls-certificate" : "" + + redirects_service_port = var.frontend_service_paths != [] ? var.frontend_service_port : var.backend_service_port } terraform { @@ -372,7 +374,7 @@ resource "kubernetes_manifest" "ingressroute_redirect_to_https" { services = [ { name = coalesce(var.frontend_service_slug, var.backend_service_slug) - port = coalesce(var.frontend_service_port, var.backend_service_port) + port = local.redirects_service_port } ] } @@ -430,7 +432,7 @@ resource "kubernetes_manifest" "ingressroute_secondary_domains_redirect" { services = [ { name = coalesce(var.frontend_service_slug, var.backend_service_slug) - port = coalesce(var.frontend_service_port, var.backend_service_port) + port = local.redirects_service_port } ] }