Add change_script to service module

This commit is contained in:
IamTheFij 2023-11-06 14:41:13 -08:00
parent a2d33ac309
commit df1ae60936
2 changed files with 16 additions and 2 deletions

View File

@ -175,6 +175,14 @@ EOF
%{~ if template.change_signal != null } %{~ if template.change_signal != null }
change_signal = "${template.change_signal}" change_signal = "${template.change_signal}"
%{~ endif ~} %{~ endif ~}
%{~ if template.change_script != null }
change_script {
command = "${template.change_script.command}"
args = ${jsonencode(template.change_script.args)}
timeout = "${template.change_script.timeout}"
fail_on_error = ${template.change_script.fail_on_error}
}
%{~ endif ~}
%{~ if template.env != null } %{~ if template.env != null }
env = ${template.env} env = ${template.env}
%{~ endif ~} %{~ endif ~}

View File

@ -158,12 +158,18 @@ variable "templates" {
data = string data = string
dest = string dest = string
dest_prefix = optional(string, "$${NOMAD_TASK_DIR}") dest_prefix = optional(string, "$${NOMAD_TASK_DIR}")
change_mode = optional(string)
change_signal = optional(string)
left_delimiter = optional(string) left_delimiter = optional(string)
right_delimiter = optional(string) right_delimiter = optional(string)
mount = optional(bool, true) mount = optional(bool, true)
env = optional(bool, false) env = optional(bool, false)
change_mode = optional(string)
change_signal = optional(string)
change_script = optional(object({
command = optional(string, "")
args = optional(list(string), [])
timeout = optional(string, "5s")
fail_on_error = optional(bool, false)
}))
})) }))
default = [] default = []
description = "Templates to be used" description = "Templates to be used"