Some checks failed
Deploy / Update K8s Apps / Detect changed K8s tfvars (push) Successful in 12s
Deploy / Update Apps / Detect changed tfvars files (push) Successful in 11s
Test / Unit Tests — Docker Stack (push) Has been skipped
Test / Unit Tests — K8s Stack (push) Has been skipped
Test / Static Analysis (push) Failing after 23s
Deploy / Update K8s Apps / Deploy ${{ matrix.tfvars }} (push) Failing after 12s
Deploy / Update K8s Apps / Destroy ${{ matrix.tfvars }} (push) Has been skipped
Deploy / Update Apps / Deploy ${{ matrix.tfvars }} (push) Failing after 12s
Deploy / Update Apps / Destroy ${{ matrix.tfvars }} (push) Has been skipped
Test / Integration Test — K8s (k3d) (push) Has been skipped
153 lines
5.8 KiB
HCL
153 lines
5.8 KiB
HCL
# ─── App Identity ─────────────────────────────────────────────────────────────
|
|
|
|
variable "app_name" {
|
|
description = "Unique name for this app deployment. Used as prefix for all container, network and volume names."
|
|
type = string
|
|
}
|
|
|
|
variable "environment" {
|
|
description = "Deployment environment. Controls volume persistence: 'prod' = named volumes, 'dev' = ephemeral."
|
|
type = string
|
|
default = "dev"
|
|
|
|
validation {
|
|
condition = contains(["prod", "dev"], var.environment)
|
|
error_message = "environment must be 'prod' or 'dev'."
|
|
}
|
|
}
|
|
|
|
# ─── OpenResty: source type ────────────────────────────────────────────────────
|
|
|
|
variable "openresty_source_type" {
|
|
description = <<-EOT
|
|
How to provide OpenResty config / Lua code. One of:
|
|
bind_mount - mount an existing directory from the remote host filesystem
|
|
local_build - build a Docker image from a local Dockerfile context (sent to remote daemon)
|
|
git_clone - clone a git repo at container startup (requires git-capable base image or apk)
|
|
EOT
|
|
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'."
|
|
}
|
|
}
|
|
|
|
# ─── OpenResty: base image (bind_mount / git_clone) ───────────────────────────
|
|
|
|
variable "openresty_image" {
|
|
description = "OpenResty Docker image used for bind_mount and git_clone modes."
|
|
type = string
|
|
default = "openresty/openresty:1.25.3-alpine"
|
|
}
|
|
|
|
# ─── OpenResty: bind_mount options ────────────────────────────────────────────
|
|
|
|
variable "openresty_remote_config_path" {
|
|
description = <<-EOT
|
|
Absolute path on the REMOTE HOST to mount as /usr/local/openresty/nginx/conf inside the container.
|
|
Only used when openresty_source_type = 'bind_mount'.
|
|
EOT
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
# ─── OpenResty: local_build options ───────────────────────────────────────────
|
|
|
|
variable "openresty_local_build_context" {
|
|
description = <<-EOT
|
|
Path to the local Dockerfile build context directory (relative to the tofu working directory).
|
|
The context is transferred to the remote Docker daemon over SSH and built there.
|
|
Only used when openresty_source_type = 'local_build'.
|
|
EOT
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "openresty_dockerfile" {
|
|
description = "Dockerfile filename inside the build context. Only used when openresty_source_type = 'local_build'."
|
|
type = string
|
|
default = "Dockerfile"
|
|
}
|
|
|
|
# ─── OpenResty: git_clone options ─────────────────────────────────────────────
|
|
|
|
variable "openresty_git_repo" {
|
|
description = <<-EOT
|
|
Git repository URL to clone at container startup.
|
|
Only used when openresty_source_type = 'git_clone'.
|
|
The cloned repo must contain an 'openresty/' directory with a valid nginx.conf.
|
|
EOT
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "openresty_git_ref" {
|
|
description = <<-EOT
|
|
Git ref to checkout. Must be a pinned tag or full commit SHA — never a branch name.
|
|
Mutable branch names cause non-reproducible container restarts (the same image
|
|
could contain different code each time the container is recreated).
|
|
Only used when openresty_source_type = 'git_clone'.
|
|
EOT
|
|
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 = <<-EOT
|
|
Optional personal access token for private git repositories.
|
|
Injected into the clone URL as oauth2:<token>@.
|
|
Only used when openresty_source_type = 'git_clone'.
|
|
EOT
|
|
type = string
|
|
default = ""
|
|
sensitive = true
|
|
}
|
|
|
|
# ─── Networking & Ports ───────────────────────────────────────────────────────
|
|
|
|
variable "openresty_external_port" {
|
|
description = "Port exposed on the remote host that forwards to OpenResty port 80."
|
|
type = number
|
|
}
|
|
|
|
# ─── 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"
|
|
}
|