2023-05-10 21:05:10 +02:00
|
|
|
resource "local_file" "nixos_vars" {
|
|
|
|
content = jsonencode(local.nixos_vars)
|
|
|
|
filename = var.nixos_vars_file
|
|
|
|
file_permission = "600"
|
|
|
|
|
|
|
|
provisioner "local-exec" {
|
|
|
|
interpreter = ["bash", "-c"]
|
2023-10-24 17:33:05 +02:00
|
|
|
command = "git add -f '${var.nixos_vars_file}'"
|
2023-05-10 21:05:10 +02:00
|
|
|
}
|
|
|
|
# also pro-actively add hosts and flake-module.nix to git so nix can find it.
|
|
|
|
provisioner "local-exec" {
|
|
|
|
interpreter = ["bash", "-c"]
|
|
|
|
command = <<EOT
|
2023-10-24 17:33:05 +02:00
|
|
|
git add "$(dirname '${var.nixos_vars_file}')"/{hosts,flake-module.nix}
|
2023-05-10 21:05:10 +02:00
|
|
|
EOT
|
|
|
|
on_failure = continue
|
|
|
|
}
|
|
|
|
}
|