Skip to content

Commit

Permalink
Add service meta
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienneCohea committed Dec 17, 2021
1 parent ae9046a commit 9d8a0dc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions quake.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ resource "nomad_job" "quake" {
jobspec = templatefile("${path.module}/quake/quake.hcl", {
datacenter = var.datacenter
rcon_password = var.rcon_password
service_meta = merge({
protocol = "udp"
port = 27500
}, var.service_meta)
})
}
17 changes: 17 additions & 0 deletions quake/quake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ job "quake" {
}

task "nquakesv" {
service {
meta = {
%{for key, value in service_meta}
"${key}" = "${value}"
%{endfor}
}

port = "quake"

check {
type = "tcp"
port = "quake"
interval = "10s"
timeout = "2s"
}
}

driver = "docker"

config {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ variable "rcon_password" {
type = string
description = "The password for RCON (remote console)"
}

variable "service_meta" {
type = map(string)
default = {}
description = "Register the service in Consul with the given service metadata"
}

0 comments on commit 9d8a0dc

Please sign in to comment.