From 9fe63d03d96cbb10ff2ffd7ac1a72c3703f1b63f Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Mon, 27 Feb 2023 11:48:24 -0800 Subject: [PATCH] Add image_pull_timeout to service template --- services/service/main.tf | 13 +++++++------ services/service/service_template.nomad | 3 +++ services/service/vars.tf | 6 ++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/services/service/main.tf b/services/service/main.tf index 04b27bf..4039d18 100644 --- a/services/service/main.tf +++ b/services/service/main.tf @@ -1,11 +1,12 @@ resource "nomad_job" "service" { jobspec = templatefile("${path.module}/service_template.nomad", { - name = var.name - image = var.image - args = var.args - env = var.env - meta = var.meta - group_meta = var.group_meta + name = var.name + image = var.image + image_pull_timeout = var.image_pull_timeout + args = var.args + env = var.env + meta = var.meta + group_meta = var.group_meta service_port = var.service_port sticky_disk = var.sticky_disk diff --git a/services/service/service_template.nomad b/services/service/service_template.nomad index a4fb3f7..5ea93bb 100644 --- a/services/service/service_template.nomad +++ b/services/service/service_template.nomad @@ -131,6 +131,9 @@ job "${name}" { %{ endif ~} config { image = "${image}" + %{if image_pull_timeout != null ~} + image_pull_timeout = "${image_pull_timeout}" + %{ endif ~} %{ if service_port != null ~} ports = ["main"] %{ endif ~} diff --git a/services/service/vars.tf b/services/service/vars.tf index d435e59..2f98a91 100644 --- a/services/service/vars.tf +++ b/services/service/vars.tf @@ -8,6 +8,12 @@ variable "image" { description = "Image that should be run" } +variable "image_pull_timeout" { + type = string + default = null + description = "A time duration that controls how long Nomad will wait before cancelling an in-progress pull of the Docker image" +} + variable "meta" { type = map(string) default = {}