diff --git a/modules/01-networking/cloudflared-tunnel/main.tf b/modules/01-networking/cloudflared-tunnel/main.tf index 75c5bc3..99d83d8 100644 --- a/modules/01-networking/cloudflared-tunnel/main.tf +++ b/modules/01-networking/cloudflared-tunnel/main.tf @@ -29,10 +29,10 @@ locals { // Transform service definitions into ingress rules format, only for services with ingress_enabled service_ingress_rules = flatten([ for service in var.service_definitions : - // Only process services with hostnames AND where ingress is enabled (or default to true for backward compatibility) - (length(service.hostnames) > 0) ? [ - for hostname in service.hostnames : { - hostname = "${hostname}.${var.domain}" + // Only process services with subdomains AND where ingress is enabled (or default to true for backward compatibility) + (length(service.subdomains) > 0) ? [ + for subdomain in service.subdomains : { + hostname = "${subdomain}.${var.domain}" service = service.endpoint } ] : [] diff --git a/modules/01-networking/cloudflared-tunnel/variables.tf b/modules/01-networking/cloudflared-tunnel/variables.tf index 7f392a9..7325f3b 100644 --- a/modules/01-networking/cloudflared-tunnel/variables.tf +++ b/modules/01-networking/cloudflared-tunnel/variables.tf @@ -53,7 +53,7 @@ variable "service_definitions" { name = string primary_port = number endpoint = string - hostnames = optional(list(string), []) + subdomains = optional(list(string), []) })) default = [] } diff --git a/modules/20-services-apps/actualbudget/main.tf b/modules/20-services-apps/actualbudget/main.tf index 984e80c..688ef63 100644 --- a/modules/20-services-apps/actualbudget/main.tf +++ b/modules/20-services-apps/actualbudget/main.tf @@ -20,7 +20,7 @@ locals { image_tag = var.image_tag != "" ? var.image_tag : "latest" monitoring = true exposed_port = 5006 - hostnames = ["budget"] + subdomains = ["budget"] default_volumes = [ { container_path = "/data" @@ -46,6 +46,6 @@ output "service_definition" { name = local.container_name primary_port = local.exposed_port endpoint = "http://${local.container_name}:${local.exposed_port}" - hostnames = local.hostnames + subdomains = local.subdomains } } diff --git a/outputs.tf b/outputs.tf index 409b83f..ab635f9 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,7 +3,7 @@ output "services" { value = [ for service in module.services.service_definitions : { name = service.name - endpoint = contains(keys(service), "hostnames") ? "${service.hostnames[0]}.${module.cloudflare_globals.domain}" : service.endpoint + endpoint = contains(keys(service), "subdomains") ? "${service.subdomains[0]}.${module.cloudflare_globals.domain}" : service.endpoint } ] }