variable "base_hostname" { type = string description = "Base hostname to serve content from" default = "dev.homelab" } variable "consul_address" { type = string description = "address of consul server for dynamic routes" } data "consul_nodes" "all-nodes" { query_options { datacenter = "dc1" } } # Get hostname from Consul data "consul_keys" "base_hostname" { key { name = "base_hostname" path = "global/base_hostname" # Default to hostname provided as input variable for bootstrapping default = var.base_hostname } } resource "nomad_job" "traefik" { hcl2 { enabled = true vars = { # "consul_address" = "${var.consul_address}", "consul_address" = "http://${data.consul_nodes.all-nodes.nodes[0].address}:8500", "base_hostname" = "${data.consul_keys.base_hostname.var.base_hostname}", } } jobspec = file("${path.module}/traefik.nomad") } # locals { # authelia_config = templatefile( # "${path.module}/authelia.yml", # { # } # ) # } # # resource "nomad_job" "authelia" { # hcl2 { # enabled = true # vars = { # config_data = "${local.authelia_config}", # } # } # # jobspec = file("${path.module}/authelia.nomad") # }