homelab-nomad/traefik/traefik.tf
2022-04-13 14:02:42 -07:00

30 lines
660 B
HCL

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"
}
}
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" = "${var.base_hostname}",
}
}
jobspec = file("${path.module}/traefik.nomad")
}