From 67b1325b0844a983e3fc4bcbd5c9ac14dd2875d6 Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Sun, 24 Aug 2025 12:13:32 +0700 Subject: [PATCH] fix(infra): correct NixOS variable for Hetzner VM --- infra/.modules/hetzner-nixos/main.tf | 4 ++-- infra/.modules/hetzner-nixos/variables.tf | 7 +++++-- .../hetzner/{helsinki => }/compute/.terraform.lock.hcl | 0 .../hetzner/{helsinki => }/compute/terragrunt.hcl | 5 ++++- 4 files changed, 11 insertions(+), 5 deletions(-) rename infra/production/hetzner/{helsinki => }/compute/.terraform.lock.hcl (100%) rename infra/production/hetzner/{helsinki => }/compute/terragrunt.hcl (76%) diff --git a/infra/.modules/hetzner-nixos/main.tf b/infra/.modules/hetzner-nixos/main.tf index acb7d98..14db72e 100644 --- a/infra/.modules/hetzner-nixos/main.tf +++ b/infra/.modules/hetzner-nixos/main.tf @@ -24,8 +24,8 @@ module "nixos" { for_each = hcloud_server.nodes source = "github.com/nix-community/nixos-anywhere//terraform/all-in-one" - nixos_system_attr = "${var.flake}#nixosConfigurations.master.config.system.build.toplevel" - nixos_partitioner_attr = "${var.flake}#nixosConfigurations.master.config.system.build.diskoScript" + nixos_system_attr = "${var.nixos.flake}#nixosConfigurations.${var.nixos.host}.config.system.build.toplevel" + nixos_partitioner_attr = "${var.nixos.flake}#nixosConfigurations.${var.nixos.host}.config.system.build.diskoScript" target_host = each.value.ipv6_address instance_id = each.value.name build_on_remote = true diff --git a/infra/.modules/hetzner-nixos/variables.tf b/infra/.modules/hetzner-nixos/variables.tf index 478afd7..7ad64eb 100644 --- a/infra/.modules/hetzner-nixos/variables.tf +++ b/infra/.modules/hetzner-nixos/variables.tf @@ -4,6 +4,9 @@ variable "nodes" { })) } -variable "flake" { - +variable "nixos" { + type = object({ + flake = string + host = string + }) } diff --git a/infra/production/hetzner/helsinki/compute/.terraform.lock.hcl b/infra/production/hetzner/compute/.terraform.lock.hcl similarity index 100% rename from infra/production/hetzner/helsinki/compute/.terraform.lock.hcl rename to infra/production/hetzner/compute/.terraform.lock.hcl diff --git a/infra/production/hetzner/helsinki/compute/terragrunt.hcl b/infra/production/hetzner/compute/terragrunt.hcl similarity index 76% rename from infra/production/hetzner/helsinki/compute/terragrunt.hcl rename to infra/production/hetzner/compute/terragrunt.hcl index 1801028..5435a25 100644 --- a/infra/production/hetzner/helsinki/compute/terragrunt.hcl +++ b/infra/production/hetzner/compute/terragrunt.hcl @@ -17,5 +17,8 @@ inputs = { # location = "fsn1" # } } - flake = get_terragrunt_dir() + nixos = { + flake = "${find_in_parent_folders(".modules")}/nixos" + host = "k3s" + } } -- 2.51.2