refactor: rename hostnames to subdomains
This commit is contained in:
@@ -29,10 +29,10 @@ locals {
|
|||||||
// Transform service definitions into ingress rules format, only for services with ingress_enabled
|
// Transform service definitions into ingress rules format, only for services with ingress_enabled
|
||||||
service_ingress_rules = flatten([
|
service_ingress_rules = flatten([
|
||||||
for service in var.service_definitions :
|
for service in var.service_definitions :
|
||||||
// Only process services with hostnames AND where ingress is enabled (or default to true for backward compatibility)
|
// Only process services with subdomains AND where ingress is enabled (or default to true for backward compatibility)
|
||||||
(length(service.hostnames) > 0) ? [
|
(length(service.subdomains) > 0) ? [
|
||||||
for hostname in service.hostnames : {
|
for subdomain in service.subdomains : {
|
||||||
hostname = "${hostname}.${var.domain}"
|
hostname = "${subdomain}.${var.domain}"
|
||||||
service = service.endpoint
|
service = service.endpoint
|
||||||
}
|
}
|
||||||
] : []
|
] : []
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ variable "service_definitions" {
|
|||||||
name = string
|
name = string
|
||||||
primary_port = number
|
primary_port = number
|
||||||
endpoint = string
|
endpoint = string
|
||||||
hostnames = optional(list(string), [])
|
subdomains = optional(list(string), [])
|
||||||
}))
|
}))
|
||||||
default = []
|
default = []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ locals {
|
|||||||
image_tag = var.image_tag != "" ? var.image_tag : "latest"
|
image_tag = var.image_tag != "" ? var.image_tag : "latest"
|
||||||
monitoring = true
|
monitoring = true
|
||||||
exposed_port = 5006
|
exposed_port = 5006
|
||||||
hostnames = ["budget"]
|
subdomains = ["budget"]
|
||||||
default_volumes = [
|
default_volumes = [
|
||||||
{
|
{
|
||||||
container_path = "/data"
|
container_path = "/data"
|
||||||
@@ -46,6 +46,6 @@ output "service_definition" {
|
|||||||
name = local.container_name
|
name = local.container_name
|
||||||
primary_port = local.exposed_port
|
primary_port = local.exposed_port
|
||||||
endpoint = "http://${local.container_name}:${local.exposed_port}"
|
endpoint = "http://${local.container_name}:${local.exposed_port}"
|
||||||
hostnames = local.hostnames
|
subdomains = local.subdomains
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ output "services" {
|
|||||||
value = [
|
value = [
|
||||||
for service in module.services.service_definitions : {
|
for service in module.services.service_definitions : {
|
||||||
name = service.name
|
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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user