Enable setting static ports for service template
This commit is contained in:
parent
cb73e2b205
commit
d0641f8edf
@ -12,11 +12,12 @@ resource "nomad_job" "service" {
|
|||||||
constraints = var.constraints
|
constraints = var.constraints
|
||||||
docker_devices = var.docker_devices
|
docker_devices = var.docker_devices
|
||||||
|
|
||||||
service_port = var.service_port
|
service_port = var.service_port
|
||||||
ports = var.ports
|
service_port_static = var.service_port_static
|
||||||
sticky_disk = var.sticky_disk
|
ports = var.ports
|
||||||
resources = var.resources
|
sticky_disk = var.sticky_disk
|
||||||
service_tags = var.service_tags
|
resources = var.resources
|
||||||
|
service_tags = var.service_tags
|
||||||
|
|
||||||
ingress = var.ingress
|
ingress = var.ingress
|
||||||
ingress_rule = var.ingress_rule
|
ingress_rule = var.ingress_rule
|
||||||
|
@ -13,7 +13,11 @@ job "${name}" {
|
|||||||
%{ if service_port != null ~}
|
%{ if service_port != null ~}
|
||||||
port "main" {
|
port "main" {
|
||||||
host_network = "wesher"
|
host_network = "wesher"
|
||||||
|
%{ if service_port_static ~}
|
||||||
|
static = ${service_port}
|
||||||
|
%{ else ~}
|
||||||
to = ${service_port}
|
to = ${service_port}
|
||||||
|
%{~ endif }
|
||||||
}
|
}
|
||||||
%{ endif ~}
|
%{ endif ~}
|
||||||
%{ for port in ports ~}
|
%{ for port in ports ~}
|
||||||
|
@ -45,6 +45,12 @@ variable "service_port" {
|
|||||||
description = "Port number used by the service"
|
description = "Port number used by the service"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "service_port_static" {
|
||||||
|
type = bool
|
||||||
|
default = false
|
||||||
|
description = "Should the port assigned be static"
|
||||||
|
}
|
||||||
|
|
||||||
variable "prometheus" {
|
variable "prometheus" {
|
||||||
type = bool
|
type = bool
|
||||||
default = false
|
default = false
|
||||||
|
Loading…
Reference in New Issue
Block a user