homelab-nomad/services/service/vars.tf

312 lines
6.5 KiB
HCL

variable "name" {
type = string
description = "Name of the service"
}
variable "detach" {
type = bool
default = true
description = "Detach from Nomad and not wait for job to start"
}
variable "instance_count" {
type = number
default = 1
description = "Number of desired group instances"
}
variable "priority" {
type = number
default = 50
description = "Scheduler priority of the service"
}
variable "image" {
type = string
description = "Image that should be run"
}
variable "image_pull_timeout" {
type = string
default = null
description = "A time duration that controls how long Nomad will wait before cancelling an in-progress pull of the Docker image"
}
variable "user" {
type = string
default = null
description = "User to be passed to the task driver for execution. [ user | user:group | uid | uid:gid | user:gid | uid:group ]"
}
variable "task_meta" {
type = map(string)
default = {}
description = "Meta attributes to attach to the task"
}
variable "task_identity" {
description = "Task workload identity"
type = object({
env = optional(bool, false)
file = optional(bool, false)
})
default = null
}
variable "group_meta" {
type = map(string)
default = {}
description = "Meta attributes to attach to the group"
}
variable "job_meta" {
type = map(string)
default = {}
description = "Meta attributes to attach to the task"
}
variable "service_port" {
type = number
default = null
description = "Port number used by the service"
}
variable "service_port_static" {
type = bool
default = false
description = "Should the port assigned be static"
}
variable "prometheus" {
type = bool
default = false
description = "Should metrics be scraped by prometheus"
}
variable "ingress" {
type = bool
default = false
}
variable "sticky_disk" {
type = bool
default = false
}
variable "args" {
type = list(string)
default = []
description = "Arguments passed to the Docker container"
}
variable "resources" {
type = object({
cpu = number
memory = number
memory_max = optional(number)
})
default = {
cpu = 50
memory = 100
memory_max = null
}
description = "Resources to be assigned to the main task"
}
variable "stunnel_resources" {
type = object({
cpu = number
memory = number
memory_max = optional(number)
})
default = {
cpu = 50
memory = 15
memory_max = null
}
description = "Resources to be assigned to the stunnel sidecar task"
}
variable "env" {
type = map(string)
default = {}
description = "Env variables for the main task"
}
variable "ingress_rule" {
type = string
default = null
description = "Routing rule for ingress"
}
variable "ingress_middlewares" {
type = list(string)
default = []
description = "Traefik middlewares that should be used"
}
variable "service_tags" {
type = list(string)
default = []
description = "Additional tags to be added to the service."
}
variable "ports" {
type = list(object({
name = string
host_network = optional(string)
from = optional(number)
to = optional(number)
static = optional(number)
}))
default = []
description = "Additional ports (not service_port) to be bound."
}
variable "templates" {
type = list(object({
data = string
dest = string
dest_prefix = optional(string, "$${NOMAD_TASK_DIR}")
left_delimiter = optional(string)
right_delimiter = optional(string)
mount = optional(bool, true)
env = optional(bool, false)
perms = optional(string)
change_mode = optional(string)
change_signal = optional(string)
change_script = optional(object({
command = optional(string, "")
args = optional(list(string), [])
timeout = optional(string, "5s")
fail_on_error = optional(bool, false)
}))
}))
default = []
description = "Templates to be used"
}
variable "host_volumes" {
type = list(object({
name = string
dest = string
read_only = optional(bool)
}))
default = []
}
variable "use_mysql" {
type = bool
default = false
}
variable "use_redis" {
type = bool
default = false
}
variable "use_ldap" {
type = bool
default = false
}
variable "use_postgres" {
type = bool
default = false
}
variable "use_smtp" {
type = bool
default = false
}
variable "mysql_bootstrap" {
type = object({
enabled = optional(bool, true)
db_name_key = optional(string, "db_name")
db_user_key = optional(string, "db_user")
db_pass_key = optional(string, "db_pass")
add_ro = optional(bool, false)
})
default = null
}
variable "postgres_bootstrap" {
type = object({
enabled = optional(bool, true)
db_name_key = optional(string, "db_name")
db_user_key = optional(string, "db_user")
db_pass_key = optional(string, "db_pass")
databases = optional(list(string), [])
})
default = null
}
variable "constraints" {
type = list(object({
attribute = optional(string, "")
operator = optional(string, "=")
value = optional(string, "")
}))
default = []
}
variable "docker_devices" {
type = list(object({
host_path = string
container_path = string
}))
default = []
}
variable "custom_services" {
description = "Service definitions for any additional requested services."
type = list(object({
name = string
port = string
tags = list(string)
}))
default = []
}
variable "use_wesher" {
type = bool
description = "Indicates whether or not services should expose themselves on the wesher network"
default = true
}
variable "service_check" {
description = "Health check for main ingress service"
type = object({
name = optional(string, "")
port = optional(string, "")
path = optional(string, "/")
interval = optional(string, "30s")
timeout = optional(string, "2s")
type = optional(string, "http")
})
default = {}
}
variable "oidc_client_config" {
description = "Authelia oidc client configuration to enable oidc authentication"
type = object({
description = string
authorization_policy = optional(string, "one_factor")
redirect_uris = list(string)
scopes = list(string)
})
default = null
}