Add instance count to service template
This commit is contained in:
parent
85db434c1f
commit
2b91b6dc8f
@ -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
|
||||||
|
count = var.instance_count
|
||||||
priority = var.priority
|
priority = var.priority
|
||||||
image = var.image
|
image = var.image
|
||||||
image_pull_timeout = var.image_pull_timeout
|
image_pull_timeout = var.image_pull_timeout
|
||||||
|
@ -6,6 +6,8 @@ job "${name}" {
|
|||||||
priority = ${priority}
|
priority = ${priority}
|
||||||
|
|
||||||
group "${name}" {
|
group "${name}" {
|
||||||
|
count = ${count}
|
||||||
|
|
||||||
network {
|
network {
|
||||||
mode = "bridge"
|
mode = "bridge"
|
||||||
%{ if service_port != null ~}
|
%{ if service_port != null ~}
|
||||||
|
@ -3,6 +3,12 @@ variable "name" {
|
|||||||
description = "Name of the service"
|
description = "Name of the service"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "instance_count" {
|
||||||
|
type = number
|
||||||
|
default = 1
|
||||||
|
description = "Number of desired group instances"
|
||||||
|
}
|
||||||
|
|
||||||
variable "priority" {
|
variable "priority" {
|
||||||
type = number
|
type = number
|
||||||
default = 50
|
default = 50
|
||||||
|
Loading…
Reference in New Issue
Block a user