Some checks failed
Deploy / Update K8s Apps / Detect changed K8s tfvars (push) Failing after 13s
Deploy / Update Apps / Detect changed tfvars files (push) Failing after 13s
Test / Static Analysis (push) Failing after 11s
Test / Unit Tests — Docker Stack (push) Has been skipped
Test / Unit Tests — K8s Stack (push) Has been skipped
Deploy / Update K8s Apps / Deploy ${{ matrix.tfvars }} (push) Has been skipped
Deploy / Update K8s Apps / Destroy ${{ matrix.tfvars }} (push) Has been skipped
Deploy / Update Apps / Deploy ${{ matrix.tfvars }} (push) Has been skipped
Deploy / Update Apps / Destroy ${{ matrix.tfvars }} (push) Has been skipped
Test / Integration Test — K8s (k3d) (push) Has been skipped
65 lines
2.4 KiB
HCL
65 lines
2.4 KiB
HCL
terraform {
|
|
required_providers {
|
|
docker = {
|
|
source = "kreuzwerker/docker"
|
|
version = "~> 3.9"
|
|
}
|
|
}
|
|
}
|
|
|
|
# ─── Provider ─────────────────────────────────────────────────────────────────
|
|
# Connects to the remote Docker daemon over SSH.
|
|
# The SSH key path is supplied at runtime (typically via CI/CD from gopass).
|
|
|
|
provider "docker" {
|
|
host = "ssh://${var.ssh_user}@${var.ssh_host}"
|
|
ssh_opts = [
|
|
"-i", var.ssh_key_path,
|
|
"-o", "StrictHostKeyChecking=no",
|
|
"-o", "BatchMode=yes",
|
|
]
|
|
}
|
|
|
|
# ─── App Deployment ───────────────────────────────────────────────────────────
|
|
# One module call = one app instance. The CI/CD pipeline runs tofu separately
|
|
# per app using its own tfvars file and workspace.
|
|
|
|
module "app" {
|
|
source = "./modules/app-openresty-pg-redis"
|
|
|
|
app_name = var.app_name
|
|
environment = var.environment
|
|
|
|
openresty_source_type = var.openresty_source_type
|
|
openresty_image = var.openresty_image
|
|
openresty_external_port = var.openresty_external_port
|
|
openresty_remote_config_path = var.openresty_remote_config_path
|
|
openresty_local_build_context = var.openresty_local_build_context
|
|
openresty_dockerfile = var.openresty_dockerfile
|
|
openresty_git_repo = var.openresty_git_repo
|
|
openresty_git_ref = var.openresty_git_ref
|
|
openresty_git_token = var.openresty_git_token
|
|
|
|
db_name = var.db_name
|
|
db_user = var.db_user
|
|
db_password = var.db_password
|
|
postgres_image = var.postgres_image
|
|
redis_image = var.redis_image
|
|
}
|
|
|
|
# ─── Outputs ──────────────────────────────────────────────────────────────────
|
|
|
|
output "openresty_url" {
|
|
description = "URL to reach the deployed app."
|
|
value = "http://${var.ssh_host}:${var.openresty_external_port}"
|
|
}
|
|
|
|
output "app_containers" {
|
|
description = "Names of all deployed containers."
|
|
value = {
|
|
openresty = module.app.openresty_container_name
|
|
postgres = module.app.postgres_container_name
|
|
redis = module.app.redis_container_name
|
|
}
|
|
}
|