Add ability to set priority for service templates

This commit is contained in:
IamTheFij 2023-07-06 17:23:20 -07:00
parent 2a1a7fb6b7
commit cdbd6a9cb3
3 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
resource "nomad_job" "service" { resource "nomad_job" "service" {
jobspec = templatefile("${path.module}/service_template.nomad", { jobspec = templatefile("${path.module}/service_template.nomad", {
name = var.name name = var.name
priority = var.priority
image = var.image image = var.image
image_pull_timeout = var.image_pull_timeout image_pull_timeout = var.image_pull_timeout
args = var.args args = var.args

View File

@ -3,6 +3,7 @@ job "${name}" {
datacenters = ["dc1"] datacenters = ["dc1"]
type = "service" type = "service"
priority = ${priority}
group "${name}" { group "${name}" {
network { network {

View File

@ -3,6 +3,13 @@ variable "name" {
description = "Name of the service" description = "Name of the service"
} }
variable "priority" {
type = number
default = 50
description = "Scheduler priority of the service"
}
variable "image" { variable "image" {
type = string type = string
description = "Image that should be run" description = "Image that should be run"