Files
homelab/modules/10-generic/docker-service/variables.tf
T
2025-11-12 15:00:38 +00:00

214 lines
4.2 KiB
Terraform

variable "container_name" {
description = "Name of the container"
type = string
}
variable "image" {
description = "Image name"
type = string
}
variable "tag" {
description = "Image tag"
type = string
default = "latest"
}
variable "keep_image_locally" {
description = "Whether to keep the image locally after pulling"
type = bool
default = true
}
variable "restart_policy" {
description = "Restart policy (no, always, unless-stopped, on-failure)"
type = string
default = "always"
}
variable "network_mode" {
description = "Network mode (bridge, host, etc.)"
type = string
default = "bridge"
}
variable "ports" {
description = "List of port mappings"
type = list(object({
internal = number
external = number
protocol = string
}))
default = []
}
variable "networks" {
description = "List of networks to connect the container to"
type = list(string)
default = []
}
variable "volumes" {
description = "List of volume mappings"
type = list(object({
host_path = string
container_path = string
read_only = bool
}))
default = []
}
variable "env_vars" {
description = "Environment variables for the container"
type = map(string)
default = {}
sensitive = true
}
variable "puid" {
description = "User ID for the container"
type = number
default = null
}
variable "pgid" {
description = "Group ID for the container"
type = number
default = null
}
variable "labels" {
description = "Container labels"
type = map(string)
default = {}
}
variable "host_mappings" {
description = "Additional host mappings for the container (/etc/hosts entries)"
type = list(object({
host = string
ip = string
}))
default = []
}
variable "healthcheck" {
description = "Container healthcheck configuration"
type = object({
test = list(string)
interval = string
timeout = string
start_period = optional(string)
retries = number
})
default = null
}
// Resource limits
variable "memory_limit" {
description = "Memory limit for the container (in MB)"
type = number
default = null
}
variable "memory_swap_limit" {
description = "Memory swap limit for the container (in MB)"
type = number
default = null
}
variable "cpu_shares" {
description = "CPU shares for the container (relative weight)"
type = number
default = null
}
// Networking options
variable "dns" {
description = "DNS servers for the container"
type = list(string)
default = null
}
variable "dns_search" {
description = "DNS search domains for the container"
type = list(string)
default = null
}
variable "hostname" {
description = "Container hostname"
type = string
default = null
}
variable "domainname" {
description = "Container domainname"
type = string
default = null
}
// Execution options
variable "user" {
description = "User to run commands as inside the container"
type = string
default = ""
}
variable "working_dir" {
description = "Working directory inside the container"
type = string
default = null
}
variable "command" {
description = "Command to run when starting the container"
type = list(string)
default = null
}
variable "entrypoint" {
description = "Entrypoint for the container"
type = list(string)
default = null
}
variable "privileged" {
description = "Run container in privileged mode"
type = bool
default = false
}
variable "security_opts" {
description = "Set's security options for container"
type = list(string)
default = null
}
variable "userns_mode" {
description = "Set's the USERNS Mode"
type = string
default = null
}
variable "gpus" {
description = "Set the GPU passthrough"
type = string
default = null
}
// Logging options
variable "log_driver" {
description = "Log driver for the container"
type = string
default = "json-file"
}
variable "log_opts" {
description = "Log driver options"
type = map(string)
default = {
max-size = "10m"
max-file = "3"
}
}