diff --git a/services/service/main.tf b/services/service/main.tf index f4198ba..18a23eb 100644 --- a/services/service/main.tf +++ b/services/service/main.tf @@ -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 diff --git a/services/service/service_template.nomad b/services/service/service_template.nomad index 1dbb8d9..7b2a939 100644 --- a/services/service/service_template.nomad +++ b/services/service/service_template.nomad @@ -6,6 +6,8 @@ job "${name}" { priority = ${priority} group "${name}" { + count = ${count} + network { mode = "bridge" %{ if service_port != null ~} diff --git a/services/service/vars.tf b/services/service/vars.tf index daf9a1e..e6905d0 100644 --- a/services/service/vars.tf +++ b/services/service/vars.tf @@ -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