orchestration-tests/nomad/traefik/traefik.tf

30 lines
660 B
Terraform
Raw Normal View History

2022-02-28 20:07:25 +00:00
variable "base_hostname" {
2022-04-13 21:01:14 +00:00
type = string
2022-02-28 20:07:25 +00:00
description = "Base hostname to serve content from"
2022-04-13 21:01:14 +00:00
default = "dev.homelab"
2022-02-28 20:07:25 +00:00
}
2022-02-27 23:22:09 +00:00
variable "consul_address" {
2022-04-13 21:01:14 +00:00
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-04-13 21:01:14 +00:00
"base_hostname" = "${var.base_hostname}",
2022-02-27 23:22:09 +00:00
}
}
jobspec = file("${path.module}/traefik.nomad")
}