From ca904d7b4e0fca609b76fb570232c3eb69e75a32 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Mon, 12 Aug 2024 19:36:50 +0200 Subject: [PATCH] tf: use tf.ref instead of config.resource.* when dependencies matter Using config.resource.* gets interpolated by Nix, whereas tf.ref gets interpolated by Terraform. The latter ends up generating implicit dependencies between resources. In practice, the lack of dependencies was only showing up when creating a new Hydra project + jobset at the same time - the concurrent / misordered creation sometimes required two different TF applications to create first the project then the jobset (the first application would end up with a failure). --- terraform/hydra.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/terraform/hydra.nix b/terraform/hydra.nix index b758616..a9b208b 100644 --- a/terraform/hydra.nix +++ b/terraform/hydra.nix @@ -33,7 +33,7 @@ in }; resource.hydra_jobset.k900-experiments = { - project = config.resource.hydra_project.forkos.name; + project = tf.ref "resource.hydra_project.forkos.name"; state = "enabled"; visible = true; name = "nixpkgs-experiments"; @@ -72,7 +72,7 @@ in }; resource.hydra_jobset.raito-nixos-rolling-small = { - project = config.resource.hydra_project.forkos.name; + project = tf.ref "resource.hydra_project.forkos.name"; state = "enabled"; visible = true; name = "raito-nixos-rolling-small"; @@ -112,7 +112,7 @@ in }; resource.hydra_jobset.delroth-nixpkgs-staging-small = { - project = config.resource.hydra_project.forkos.name; + project = tf.ref "resource.hydra_project.forkos.name"; state = "enabled"; visible = true; name = "delroth-nixpkgs-staging-small"; @@ -162,7 +162,7 @@ in }; resource.hydra_jobset.infra_main = { - project = config.resource.hydra_project.infra.name; + project = tf.ref "resource.hydra_project.infra.name"; state = "enabled"; visible = true; name = "main"; @@ -189,7 +189,7 @@ in }; resource.hydra_jobset.hydra_main = { - project = config.resource.hydra_project.hydra.name; + project = tf.ref "resource.hydra_project.hydra.name"; state = "enabled"; visible = true; name = "main"; @@ -206,7 +206,7 @@ in }; resource.hydra_jobset.nixos-staging-next-small = { - project = config.resource.hydra_project.forkos.name; + project = tf.ref "resource.hydra_project.forkos.name"; state = "enabled"; visible = true; name = "nixos-staging-next-small"; @@ -246,7 +246,7 @@ in }; resource.hydra_jobset.nixpkgs-staging-next = { - project = config.resource.hydra_project.forkos.name; + project = tf.ref "resource.hydra_project.forkos.name"; state = "enabled"; visible = true; name = "nixpkgs-staging-next"; @@ -286,7 +286,7 @@ in }; resource.hydra_jobset.nixos-main = { - project = config.resource.hydra_project.forkos.name; + project = tf.ref "resource.hydra_project.forkos.name"; state = "enabled"; visible = true; name = "nixos-main";