homelab-nomad/services/service/main.tf
2023-08-21 22:31:35 -07:00

44 lines
1.5 KiB
HCL

resource "nomad_job" "service" {
jobspec = templatefile("${path.module}/service_template.nomad", {
name = var.name
count = var.instance_count
priority = var.priority
image = var.image
image_pull_timeout = var.image_pull_timeout
args = var.args
env = var.env
task_meta = var.task_meta
group_meta = var.group_meta
job_meta = var.job_meta
constraints = var.constraints
docker_devices = var.docker_devices
service_port = var.service_port
service_port_static = var.service_port_static
ports = var.ports
sticky_disk = var.sticky_disk
resources = var.resources
stunnel_resources = var.stunnel_resources
service_tags = var.service_tags
custom_services = var.custom_services
ingress = var.ingress
ingress_rule = var.ingress_rule
ingress_middlewares = var.ingress_middlewares
prometheus = var.prometheus
templates = var.templates
host_volumes = var.host_volumes
use_mysql = var.use_mysql || var.mysql_bootstrap != null
use_redis = var.use_redis
use_ldap = var.use_ldap
use_postgres = var.use_postgres || var.postgres_bootstrap != null
mysql_bootstrap = var.mysql_bootstrap
postgres_bootstrap = var.postgres_bootstrap
stateful = var.use_mysql || var.postgres || length(var.host_volumes) > 0
})
}