Add ability to specify custom services for service module
This commit is contained in:
parent
6524631a53
commit
b9fb2d4b07
@ -18,6 +18,7 @@ resource "nomad_job" "service" {
|
||||
sticky_disk = var.sticky_disk
|
||||
resources = var.resources
|
||||
service_tags = var.service_tags
|
||||
custom_services = var.custom_services
|
||||
|
||||
ingress = var.ingress
|
||||
ingress_rule = var.ingress_rule
|
||||
|
@ -84,6 +84,16 @@ job "${name}" {
|
||||
}
|
||||
|
||||
%{ endif ~}
|
||||
%{ for custom_service in custom_services }
|
||||
service {
|
||||
name = "${custom_service.name}"
|
||||
provider = "nomad"
|
||||
port = "${custom_service.port}"
|
||||
|
||||
tags = ${jsonencode(custom_service.tags)}
|
||||
}
|
||||
|
||||
%{ endfor }
|
||||
task "${name}" {
|
||||
driver = "docker"
|
||||
|
||||
|
@ -172,6 +172,7 @@ variable "mysql_bootstrap" {
|
||||
db_pass_key = optional(string, "db_pass")
|
||||
add_ro = optional(bool, false)
|
||||
})
|
||||
|
||||
default = null
|
||||
}
|
||||
|
||||
@ -181,6 +182,7 @@ variable "constraints" {
|
||||
operator = optional(string, "=")
|
||||
value = optional(string, "")
|
||||
}))
|
||||
|
||||
default = []
|
||||
}
|
||||
|
||||
@ -192,3 +194,14 @@ variable "docker_devices" {
|
||||
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "custom_services" {
|
||||
description = "Service definitions for any additional requested services."
|
||||
type = list(object({
|
||||
name = string
|
||||
port = string
|
||||
tags = list(string)
|
||||
}))
|
||||
|
||||
default = []
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user