[ci skip] Add Terragrunt directory skeleton and root config
This commit is contained in:
parent
53229fdbb9
commit
df3228825e
4 changed files with 59 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -45,3 +45,7 @@ modules/kubernetes/frigate/config.yaml
|
|||
.claude/._*
|
||||
|
||||
._*
|
||||
|
||||
# Terragrunt
|
||||
.terragrunt-cache/
|
||||
state/
|
||||
|
|
|
|||
0
stacks/infra/.gitkeep
Normal file
0
stacks/infra/.gitkeep
Normal file
0
stacks/platform/.gitkeep
Normal file
0
stacks/platform/.gitkeep
Normal file
55
terragrunt.hcl
Normal file
55
terragrunt.hcl
Normal file
|
|
@ -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/<stack-name>/
|
||||
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 = <<EOF
|
||||
variable "kube_config_path" {
|
||||
type = string
|
||||
default = "~/.kube/config"
|
||||
}
|
||||
|
||||
provider "kubernetes" {
|
||||
config_path = var.kube_config_path
|
||||
}
|
||||
|
||||
provider "helm" {
|
||||
kubernetes {
|
||||
config_path = var.kube_config_path
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue