Add meta tags to service template
This commit is contained in:
parent
19031834fb
commit
0a798aa5a7
@ -4,6 +4,8 @@ resource "nomad_job" "service" {
|
||||
image = var.image
|
||||
args = var.args
|
||||
env = var.env
|
||||
meta = var.meta
|
||||
group_meta = var.group_meta
|
||||
|
||||
service_port = var.service_port
|
||||
sticky_disk = var.sticky_disk
|
||||
|
@ -17,6 +17,14 @@ job "${name}" {
|
||||
%{ endif ~}
|
||||
}
|
||||
|
||||
%{ if length(group_meta) > 0 ~}
|
||||
meta = {
|
||||
%{ for k, v in group_meta ~}
|
||||
${k} = ${jsonencode(v)}
|
||||
%{ endfor ~}
|
||||
}
|
||||
|
||||
%{ endif ~}
|
||||
%{ if sticky_disk ~}
|
||||
ephemeral_disk {
|
||||
migrate = true
|
||||
@ -113,6 +121,14 @@ job "${name}" {
|
||||
task "${name}" {
|
||||
driver = "docker"
|
||||
|
||||
%{ if length(meta) > 0 ~}
|
||||
meta = {
|
||||
%{ for k, v in meta ~}
|
||||
${k} = ${jsonencode(v)}
|
||||
%{ endfor ~}
|
||||
}
|
||||
|
||||
%{ endif ~}
|
||||
config {
|
||||
image = "${image}"
|
||||
%{ if service_port != null ~}
|
||||
|
@ -8,6 +8,18 @@ variable "image" {
|
||||
description = "Image that should be run"
|
||||
}
|
||||
|
||||
variable "meta" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
description = "Meta attributes to attach to the task"
|
||||
}
|
||||
|
||||
variable "group_meta" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
description = "Meta attributes to attach to the group"
|
||||
}
|
||||
|
||||
variable "service_port" {
|
||||
type = number
|
||||
default = null
|
||||
|
Loading…
Reference in New Issue
Block a user