From df3228825ee36d9429474d1d5829ddc3bed70323 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sun, 22 Feb 2026 13:01:37 +0000 Subject: [PATCH] [ci skip] Add Terragrunt directory skeleton and root config --- .gitignore | 4 +++ stacks/infra/.gitkeep | 0 stacks/platform/.gitkeep | 0 terragrunt.hcl | 55 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 stacks/infra/.gitkeep create mode 100644 stacks/platform/.gitkeep create mode 100644 terragrunt.hcl diff --git a/.gitignore b/.gitignore index 157d01df..11e07321 100755 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,7 @@ modules/kubernetes/frigate/config.yaml .claude/._* ._* + +# Terragrunt +.terragrunt-cache/ +state/ diff --git a/stacks/infra/.gitkeep b/stacks/infra/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/stacks/platform/.gitkeep b/stacks/platform/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/terragrunt.hcl b/terragrunt.hcl new file mode 100644 index 00000000..e9679e67 --- /dev/null +++ b/terragrunt.hcl @@ -0,0 +1,55 @@ +# Root Terragrunt configuration +# Provides DRY provider, backend, and variable loading for all stacks. + +# Each stack gets its own local state file under state// +remote_state { + backend = "local" + generate = { + path = "backend.tf" + if_exists = "overwrite_terragrunt" + } + config = { + path = "${get_repo_root()}/state/${path_relative_to_include()}/terraform.tfstate" + } +} + +# Load terraform.tfvars for all stacks. +# Variables not declared by a stack are silently ignored (Terraform 1.x behavior). +terraform { + extra_arguments "common_vars" { + commands = get_terraform_commands_that_need_vars() + required_var_files = [ + "${get_repo_root()}/terraform.tfvars" + ] + } + + extra_arguments "kube_config" { + commands = get_terraform_commands_that_need_vars() + arguments = [ + "-var", "kube_config_path=${get_repo_root()}/config" + ] + } +} + +# Generate kubernetes + helm providers for K8s stacks. +# The infra stack overrides this to add the proxmox provider. +generate "k8s_providers" { + path = "providers.tf" + if_exists = "overwrite_terragrunt" + contents = <