Files
OpenTofuPlayground/variables.tf
Lutz Finsterle 9fdf5164da
Some checks failed
Test / Static Analysis (push) Successful in 37s
Test / Unit Tests — Docker Stack (push) Successful in 32s
Test / Unit Tests — K8s Stack (push) Successful in 35s
Test / Integration Test — K8s (k3d) (push) Failing after 1m27s
Next Bug Fix
2026-03-14 08:49:59 +01:00

138 lines
4.4 KiB
HCL

# ─── Remote Host (SSH) ────────────────────────────────────────────────────────
variable "ssh_host" {
description = "Hostname or IP of the remote Docker host."
type = string
}
variable "ssh_user" {
description = "SSH user on the remote Docker host."
type = string
}
variable "ssh_key_path" {
description = "Absolute path to the SSH private key file used to connect to the remote host."
type = string
}
# ─── App Identity ─────────────────────────────────────────────────────────────
variable "app_name" {
description = "Unique name for this app deployment. Used as prefix for all resource names."
type = string
}
variable "environment" {
description = "Deployment environment: 'prod' (persistent volumes) or 'dev' (ephemeral)."
type = string
default = "dev"
validation {
condition = contains(["prod", "dev"], var.environment)
error_message = "environment must be 'prod' or 'dev'."
}
}
# ─── OpenResty ────────────────────────────────────────────────────────────────
variable "openresty_source_type" {
description = "OpenResty config source: 'bind_mount', 'local_build', or 'git_clone'."
type = string
validation {
condition = contains(["bind_mount", "local_build", "git_clone"], var.openresty_source_type)
error_message = "openresty_source_type must be 'bind_mount', 'local_build', or 'git_clone'."
}
}
variable "openresty_image" {
description = "Base OpenResty Docker image (bind_mount and git_clone modes)."
type = string
default = "openresty/openresty:1.25.3-alpine"
}
variable "openresty_external_port" {
description = "External port on the remote host that maps to OpenResty port 80."
type = number
}
# bind_mount
variable "openresty_remote_config_path" {
description = "Path on the REMOTE HOST to mount as OpenResty config dir (bind_mount mode)."
type = string
default = ""
}
# local_build
variable "openresty_local_build_context" {
description = "Local path to Dockerfile build context directory (local_build mode)."
type = string
default = ""
}
variable "openresty_dockerfile" {
description = "Dockerfile filename within the build context (local_build mode)."
type = string
default = "Dockerfile"
}
# git_clone
variable "openresty_git_repo" {
description = "Git repository URL to clone at container startup (git_clone mode)."
type = string
default = ""
}
variable "openresty_git_ref" {
description = "Git ref (tag, branch, commit SHA) to checkout (git_clone mode). Must be a pinned tag or SHA, not a branch name."
type = string
default = ""
validation {
condition = var.openresty_git_ref == "" || !contains(
["main", "master", "develop", "dev", "staging", "HEAD", "latest", "trunk"],
var.openresty_git_ref
)
error_message = "openresty_git_ref must be a pinned tag or commit SHA, not a mutable branch name. Got: '${var.openresty_git_ref}'."
}
}
variable "openresty_git_token" {
description = "Optional auth token for private git repos (git_clone mode)."
type = string
default = ""
sensitive = true
}
# ─── PostgreSQL ───────────────────────────────────────────────────────────────
variable "db_name" {
description = "PostgreSQL database name."
type = string
}
variable "db_user" {
description = "PostgreSQL user."
type = string
}
variable "db_password" {
description = "PostgreSQL password."
type = string
sensitive = true
}
variable "postgres_image" {
description = "PostgreSQL Docker image."
type = string
default = "postgres:16-alpine"
}
# ─── Redis ────────────────────────────────────────────────────────────────────
variable "redis_image" {
description = "Redis Docker image."
type = string
default = "redis:7-alpine"
}