Remove the module "xxx" { source = "./module" } indirection layer
from all 66 service stacks. Resources are now defined directly in
each stack's main.tf instead of through a wrapper module.
- Merge module/main.tf contents into stack main.tf
- Apply variable replacements (var.tier -> local.tiers.X, renamed vars)
- Fix shared module paths (one fewer ../ at each level)
- Move extra files/dirs (factory/, chart_values, subdirs) to stack root
- Update state files to strip module.<name>. prefix
- Update CLAUDE.md to reflect flat structure
Verified: terragrunt plan shows 0 add, 0 destroy across all stacks.
109 lines
2.4 KiB
HCL
109 lines
2.4 KiB
HCL
variable "tls_secret_name" { type = string }
|
|
|
|
locals {
|
|
tiers = {
|
|
core = "0-core"
|
|
cluster = "1-cluster"
|
|
gpu = "2-gpu"
|
|
edge = "3-edge"
|
|
aux = "4-aux"
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_namespace" "privatebin" {
|
|
metadata {
|
|
name = "privatebin"
|
|
labels = {
|
|
"istio-injection" : "disabled"
|
|
tier = local.tiers.edge
|
|
}
|
|
}
|
|
}
|
|
|
|
module "tls_secret" {
|
|
source = "../../modules/kubernetes/setup_tls_secret"
|
|
namespace = kubernetes_namespace.privatebin.metadata[0].name
|
|
tls_secret_name = var.tls_secret_name
|
|
}
|
|
|
|
resource "kubernetes_deployment" "privatebin" {
|
|
metadata {
|
|
name = "privatebin"
|
|
namespace = kubernetes_namespace.privatebin.metadata[0].name
|
|
labels = {
|
|
app = "privatebin"
|
|
tier = local.tiers.edge
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
strategy {
|
|
type = "Recreate"
|
|
}
|
|
selector {
|
|
match_labels = {
|
|
app = "privatebin"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "privatebin"
|
|
}
|
|
}
|
|
spec {
|
|
container {
|
|
image = "privatebin/nginx-fpm-alpine"
|
|
name = "privatebin"
|
|
image_pull_policy = "IfNotPresent"
|
|
port {
|
|
container_port = 8080
|
|
}
|
|
volume_mount {
|
|
name = "data"
|
|
mount_path = "/srv/data"
|
|
sub_path = "data"
|
|
}
|
|
}
|
|
|
|
volume {
|
|
name = "data"
|
|
nfs {
|
|
path = "/mnt/main/privatebin"
|
|
server = "10.0.10.15"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "privatebin" {
|
|
metadata {
|
|
name = "privatebin"
|
|
namespace = kubernetes_namespace.privatebin.metadata[0].name
|
|
labels = {
|
|
"app" = "privatebin"
|
|
}
|
|
}
|
|
|
|
spec {
|
|
selector = {
|
|
app = "privatebin"
|
|
}
|
|
port {
|
|
port = "80"
|
|
target_port = "8080"
|
|
}
|
|
}
|
|
}
|
|
|
|
module "ingress" {
|
|
source = "../../modules/kubernetes/ingress_factory"
|
|
namespace = kubernetes_namespace.privatebin.metadata[0].name
|
|
name = "privatebin"
|
|
host = "pb"
|
|
tls_secret_name = var.tls_secret_name
|
|
rybbit_site_id = "3ae810b0476d"
|
|
custom_content_security_policy = "script-src 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' https://rybbit.viktorbarzin.me"
|
|
}
|