terraform-nixos #1

Closed
kiara wants to merge 57 commits from terraform-nixos into tf
Showing only changes of commit 6a105c2fce - Show all commits

View file

@ -98,19 +98,26 @@ data "external" "hash" {
program = ["echo", "{\"hash\":\"$(nix-hash ..)\"}"]
}
# merge instantiate/deploy, cuz i don't want 24+s instantiates when nothing changed.
# merged instantiate/deploy to prevent 24+s instantiates when nothing changed.
# terraform-nixos separates these to only deploy if instantiate changed.
# FIXME find a better solution for this. current considerations were:
# - `resource null_resource` cannot have outputs, while we want info from the instantiation (unless built on host?).
# - `data external` always runs, which is undesirable for steps like deploy/instantiation.
# FIXME null_resource docs recommend terraform_data over null_resource
resource "null_resource" "deploy_nixos" {
# - generic resources cannot have outputs, while we want info from the instantiation (unless built on host?).
# - `data` always runs, which is slow for deploy/instantiation.
resource "terraform_data" "nixos" {
for_each = {for name, inst in merge(
local.peripherals,
local.applications,
) : name => inst if inst.cfg.enable}
triggers = data.external.hash.result
triggers_replace = [
data.external.hash.result,
var.deploy_environment,
var.domain,
var.initialUser,
local.system,
each.key,
each.value,
]
provisioner "local-exec" {
working_dir = path.root