Add instance count to service template

This commit is contained in:
IamTheFij 2023-07-07 15:51:19 -07:00
parent 85db434c1f
commit 2b91b6dc8f
3 changed files with 9 additions and 0 deletions

View File

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

View File

@ -6,6 +6,8 @@ job "${name}" {
priority = ${priority}
group "${name}" {
count = ${count}
network {
mode = "bridge"
%{ if service_port != null ~}

View File

@ -3,6 +3,12 @@ variable "name" {
description = "Name of the service"
}
variable "instance_count" {
type = number
default = 1
description = "Number of desired group instances"
}
variable "priority" {
type = number
default = 50