Compare commits
2 Commits
main
...
stateful-j
Author | SHA1 | Date | |
---|---|---|---|
18c45219d8 | |||
2e2e4f2064 |
@ -7,8 +7,9 @@ resource "nomad_job" "service" {
|
|||||||
image_pull_timeout = var.image_pull_timeout
|
image_pull_timeout = var.image_pull_timeout
|
||||||
args = var.args
|
args = var.args
|
||||||
env = var.env
|
env = var.env
|
||||||
meta = var.meta
|
task_meta = var.task_meta
|
||||||
group_meta = var.group_meta
|
group_meta = var.group_meta
|
||||||
|
job_meta = var.job_meta
|
||||||
constraints = var.constraints
|
constraints = var.constraints
|
||||||
docker_devices = var.docker_devices
|
docker_devices = var.docker_devices
|
||||||
|
|
||||||
@ -36,5 +37,7 @@ resource "nomad_job" "service" {
|
|||||||
|
|
||||||
mysql_bootstrap = var.mysql_bootstrap
|
mysql_bootstrap = var.mysql_bootstrap
|
||||||
postgres_bootstrap = var.postgres_bootstrap
|
postgres_bootstrap = var.postgres_bootstrap
|
||||||
|
|
||||||
|
stateful = var.use_mysql || var.postgres || length(var.host_volumes) > 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,14 @@ job "${name}" {
|
|||||||
type = "service"
|
type = "service"
|
||||||
priority = ${priority}
|
priority = ${priority}
|
||||||
|
|
||||||
|
%{ if length(job_meta) > 0 }
|
||||||
|
meta = {
|
||||||
|
%{ for k, v in job_meta }
|
||||||
|
${k} = ${jsonencode(v)}
|
||||||
|
%{ endfor }
|
||||||
|
}
|
||||||
|
%{~ endif }
|
||||||
|
|
||||||
group "${name}" {
|
group "${name}" {
|
||||||
count = ${count}
|
count = ${count}
|
||||||
|
|
||||||
@ -98,9 +106,9 @@ job "${name}" {
|
|||||||
task "${name}" {
|
task "${name}" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
%{ if length(meta) > 0 ~}
|
%{ if length(task_meta) > 0 ~}
|
||||||
meta = {
|
meta = {
|
||||||
%{ for k, v in meta ~}
|
%{ for k, v in task_meta ~}
|
||||||
${k} = ${jsonencode(v)}
|
${k} = ${jsonencode(v)}
|
||||||
%{ endfor ~}
|
%{ endfor ~}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ variable "image_pull_timeout" {
|
|||||||
description = "A time duration that controls how long Nomad will wait before cancelling an in-progress pull of the Docker image"
|
description = "A time duration that controls how long Nomad will wait before cancelling an in-progress pull of the Docker image"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "meta" {
|
variable "task_meta" {
|
||||||
type = map(string)
|
type = map(string)
|
||||||
default = {}
|
default = {}
|
||||||
description = "Meta attributes to attach to the task"
|
description = "Meta attributes to attach to the task"
|
||||||
@ -39,6 +39,12 @@ variable "group_meta" {
|
|||||||
description = "Meta attributes to attach to the group"
|
description = "Meta attributes to attach to the group"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "job_meta" {
|
||||||
|
type = map(string)
|
||||||
|
default = {}
|
||||||
|
description = "Meta attributes to attach to the job"
|
||||||
|
}
|
||||||
|
|
||||||
variable "service_port" {
|
variable "service_port" {
|
||||||
type = number
|
type = number
|
||||||
default = null
|
default = null
|
||||||
|
Loading…
Reference in New Issue
Block a user