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.
124 lines
2.4 KiB
HCL
124 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" "tor-proxy" {
|
|
metadata {
|
|
name = "tor-proxy"
|
|
labels = {
|
|
"istio-injection" : "disabled"
|
|
tier = local.tiers.aux
|
|
}
|
|
}
|
|
}
|
|
|
|
module "tls_secret" {
|
|
source = "../../modules/kubernetes/setup_tls_secret"
|
|
namespace = "tor-proxy"
|
|
tls_secret_name = var.tls_secret_name
|
|
}
|
|
|
|
# resource "kubernetes_config_map" "tor_config" {
|
|
# metadata {
|
|
# name = "tor-config"
|
|
# namespace = "tor-proxy"
|
|
# annotations = {
|
|
# "reloader.stakater.com/match" = "true"
|
|
# }
|
|
# }
|
|
|
|
# data = {
|
|
# "torrc" = file("${path.module}/.torrc")
|
|
# }
|
|
# }
|
|
|
|
resource "kubernetes_deployment" "tor-proxy" {
|
|
metadata {
|
|
name = "tor-proxy"
|
|
namespace = "tor-proxy"
|
|
labels = {
|
|
app = "tor-proxy"
|
|
tier = local.tiers.aux
|
|
}
|
|
annotations = {
|
|
"reloader.stakater.com/search" = "true"
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
strategy {
|
|
type = "RollingUpdate"
|
|
}
|
|
selector {
|
|
match_labels = {
|
|
app = "tor-proxy"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "tor-proxy"
|
|
}
|
|
}
|
|
spec {
|
|
container {
|
|
name = "tor-proxy"
|
|
image = "dperson/torproxy:latest"
|
|
port {
|
|
name = "http"
|
|
container_port = 8118
|
|
protocol = "TCP"
|
|
}
|
|
port {
|
|
name = "tor"
|
|
container_port = 9050
|
|
protocol = "TCP"
|
|
}
|
|
# volume_mount {
|
|
# name = "tor-config"
|
|
# mount_path = "/etc/tor/torrc"
|
|
# sub_path = "torrc"
|
|
# }
|
|
}
|
|
# volume {
|
|
# name = "tor-config"
|
|
# config_map {
|
|
# name = kubernetes_config_map.tor_config.metadata[0].name
|
|
# }
|
|
# }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "tor-proxy" {
|
|
metadata {
|
|
name = "tor-proxy"
|
|
namespace = "tor-proxy"
|
|
labels = {
|
|
"app" = "tor-proxy"
|
|
}
|
|
}
|
|
|
|
spec {
|
|
selector = {
|
|
app = "tor-proxy"
|
|
}
|
|
port {
|
|
name = "http"
|
|
port = 8118
|
|
}
|
|
port {
|
|
name = "tor"
|
|
port = 9050
|
|
}
|
|
}
|
|
}
|