homelab-nomad/traefik/traefik.tf

31 lines
642 B
Terraform
Raw Normal View History

2022-02-28 20:07:25 +00:00
variable "base_hostname" {
type = string
description = "Base hostname to serve content from"
default = "dev.homelab"
}
2022-02-27 23:22:09 +00:00
variable "consul_address" {
type = string
description = "address of consul server for dynamic routes"
2022-02-27 23:22:09 +00:00
}
2022-03-13 17:13:19 +00:00
data "consul_nodes" "all-nodes" {
query_options {
datacenter = "dc1"
}
}
2022-02-27 23:22:09 +00:00
resource "nomad_job" "traefik" {
hcl2 {
enabled = true
vars = {
2022-03-13 17:13:19 +00:00
# "consul_address" = "${var.consul_address}",
"consul_address" = "http://${data.consul_nodes.all-nodes.nodes[0].address}:8500",
2022-02-28 20:07:25 +00:00
"base_hostname" = "${var.base_hostname}",
2022-02-27 23:22:09 +00:00
}
}
jobspec = file("${path.module}/traefik.nomad")
}