Files
OpenTofuPlayground/k8s/main.tf
Lutz Finsterle 3bf5960302
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
Initial Commit
2026-03-06 19:17:15 +01:00

77 lines
2.5 KiB
HCL

terraform {
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.31"
}
kubectl = {
source = "gavinbunney/kubectl"
version = "~> 1.14"
}
}
}
# ─── Providers ────────────────────────────────────────────────────────────────
# Both providers connect to the same cluster via the same kubeconfig.
# kubectl is used exclusively for Traefik CRD resources (IngressRoute, Middleware)
# because it does not validate CRD schemas at plan time, unlike kubernetes_manifest.
provider "kubernetes" {
config_path = var.kubeconfig_path
}
provider "kubectl" {
config_path = var.kubeconfig_path
}
# ─── App Deployment ───────────────────────────────────────────────────────────
module "app" {
source = "../modules/app-k8s-nodered-rabbitmq"
app_name = var.app_name
environment = var.environment
app_image = var.app_image
app_port = var.app_port
init_container_image = var.init_container_image
init_data_src_path = var.init_data_src_path
storage_class = var.storage_class
app_pvc_size = var.app_pvc_size
app_path_prefix = var.app_path_prefix
traefik_entrypoint = var.traefik_entrypoint
traefik_api_group = var.traefik_api_group
alloy_image = var.alloy_image
loki_endpoint = var.loki_endpoint
loki_auth_token = var.loki_auth_token
enable_rabbitmq = var.enable_rabbitmq
rabbitmq_image = var.rabbitmq_image
rabbitmq_user = var.rabbitmq_user
rabbitmq_password = var.rabbitmq_password
rabbitmq_vhost = var.rabbitmq_vhost
rabbitmq_pvc_size = var.rabbitmq_pvc_size
rabbitmq_path_prefix = var.rabbitmq_path_prefix
}
# ─── Outputs ──────────────────────────────────────────────────────────────────
output "namespace" {
description = "Kubernetes namespace for this app."
value = module.app.namespace
}
output "app_url_path" {
description = "Path prefix the app is accessible at via Traefik."
value = module.app.app_path_prefix
}
output "rabbitmq_amqp_url" {
description = "In-cluster AMQP URL (empty if RabbitMQ is disabled)."
value = module.app.rabbitmq_amqp_url
}