diff --git a/aks/main.tf b/aks/main.tf index ae9bad7b..2ad1bec7 100644 --- a/aks/main.tf +++ b/aks/main.tf @@ -61,6 +61,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/eks/main.tf b/eks/main.tf index d638c08a..60cc0ade 100644 --- a/eks/main.tf +++ b/eks/main.tf @@ -3,6 +3,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/kind/main.tf b/kind/main.tf index d638c08a..60cc0ade 100644 --- a/kind/main.tf +++ b/kind/main.tf @@ -3,6 +3,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/locals.tf b/locals.tf index a8623750..ef247028 100644 --- a/locals.tf +++ b/locals.tf @@ -73,7 +73,7 @@ locals { resources = local.thanos.compactor_resources persistence = { # The Access Mode needs to be set as ReadWriteOnce because AWS Elastic Block storage does not support other - # modes (https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes). + # modes (https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes). # Since the compactor is the only pod accessing this volume, there should be no issue to have this as # ReadWriteOnce (https://stackoverflow.com/a/57799347). accessModes = [ @@ -127,7 +127,7 @@ locals { hostname = "" extraRules = [ { - host = "thanos-bucketweb.apps.${var.base_domain}" + host = "thanos-bucketweb.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}" http = { paths = [ { @@ -168,7 +168,7 @@ locals { extraTls = [{ secretName = "thanos-bucketweb-tls" hosts = [ - "thanos-bucketweb.apps.${var.base_domain}", + "thanos-bucketweb.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}", "${local.thanos.bucketweb_domain}" ] }] @@ -261,7 +261,7 @@ locals { hostname = "" extraRules = [ { - host = "thanos-query.apps.${var.base_domain}" + host = "thanos-query.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}" http = { paths = [ { @@ -302,7 +302,7 @@ locals { extraTls = [{ secretName = "thanos-query-tls" hosts = [ - "thanos-query.apps.${var.base_domain}", + "thanos-query.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}", "${local.thanos.query_domain}" ] }] @@ -316,8 +316,8 @@ locals { }] thanos_defaults = { - query_domain = "thanos-query.apps.${var.cluster_name}.${var.base_domain}" - bucketweb_domain = "thanos-bucketweb.apps.${var.cluster_name}.${var.base_domain}" + query_domain = "thanos-query.${trimprefix("${var.subdomain}.${var.cluster_name}", ".")}.${var.base_domain}" + bucketweb_domain = "thanos-bucketweb.${trimprefix("${var.subdomain}.${var.cluster_name}", ".")}.${var.base_domain}" # TODO Create proper Terraform variables for these values instead of bundling everything inside of these locals diff --git a/sks/main.tf b/sks/main.tf index d638c08a..60cc0ade 100644 --- a/sks/main.tf +++ b/sks/main.tf @@ -3,6 +3,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/variables.tf b/variables.tf index 673b44de..9748951e 100644 --- a/variables.tf +++ b/variables.tf @@ -12,6 +12,12 @@ variable "base_domain" { type = string } +variable "subdomain" { + description = "Sub domain of the cluster. Value used for the ingress' URL of the application." + type = string + default = "apps" +} + variable "argocd_project" { description = "Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application." type = string