From 0ca6ec76c44d7eb3c8f4313e5b1d68942f1bc593 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Sun, 15 Oct 2023 18:43:19 +0200 Subject: [PATCH] Maybe terraform will cooperate now? Signed-off-by: magic_rb --- terranix/containers/website/default.nix | 3 +++ terranix/lib/nomad_job.nix | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/terranix/containers/website/default.nix b/terranix/containers/website/default.nix index 36c9815..623e921 100644 --- a/terranix/containers/website/default.nix +++ b/terranix/containers/website/default.nix @@ -6,6 +6,9 @@ let in { resource."nomad_job"."website" = nomadJob { + lifecycle.replace_triggered_by = [ + "resource.nomad_job.website.hcl2[0].vars[\"flake_path\"]" + ]; jobspec = ./job.hcl; vars = { flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; diff --git a/terranix/lib/nomad_job.nix b/terranix/lib/nomad_job.nix index c85fe4f..0c1ac5d 100644 --- a/terranix/lib/nomad_job.nix +++ b/terranix/lib/nomad_job.nix @@ -9,8 +9,11 @@ enabled = true; inherit vars; }; - lifecycle.ignore_changes = [ - "hcl2[0].vars[\"flake_ref\"]" - "hcl2[0].vars[\"flake_sha\"]" - ]; + lifecycle = { + ignore_changes = [ + "hcl2[0].vars[\"flake_ref\"]" + "hcl2[0].vars[\"flake_sha\"]" + ]; + create_before_destroy = true; + }; } // builtins.removeAttrs args [ "jobspec" "vars" ]