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).
This commit is contained in:
Pierre Bourdon 2024-08-12 19:36:50 +02:00
parent 84efd0976d
commit ca904d7b4e
Signed by: delroth
GPG key ID: 6FB80DCD84DA0F1C

View file

@ -33,7 +33,7 @@ in
}; };
resource.hydra_jobset.k900-experiments = { resource.hydra_jobset.k900-experiments = {
project = config.resource.hydra_project.forkos.name; project = tf.ref "resource.hydra_project.forkos.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "nixpkgs-experiments"; name = "nixpkgs-experiments";
@ -72,7 +72,7 @@ in
}; };
resource.hydra_jobset.raito-nixos-rolling-small = { resource.hydra_jobset.raito-nixos-rolling-small = {
project = config.resource.hydra_project.forkos.name; project = tf.ref "resource.hydra_project.forkos.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "raito-nixos-rolling-small"; name = "raito-nixos-rolling-small";
@ -112,7 +112,7 @@ in
}; };
resource.hydra_jobset.delroth-nixpkgs-staging-small = { resource.hydra_jobset.delroth-nixpkgs-staging-small = {
project = config.resource.hydra_project.forkos.name; project = tf.ref "resource.hydra_project.forkos.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "delroth-nixpkgs-staging-small"; name = "delroth-nixpkgs-staging-small";
@ -162,7 +162,7 @@ in
}; };
resource.hydra_jobset.infra_main = { resource.hydra_jobset.infra_main = {
project = config.resource.hydra_project.infra.name; project = tf.ref "resource.hydra_project.infra.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "main"; name = "main";
@ -189,7 +189,7 @@ in
}; };
resource.hydra_jobset.hydra_main = { resource.hydra_jobset.hydra_main = {
project = config.resource.hydra_project.hydra.name; project = tf.ref "resource.hydra_project.hydra.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "main"; name = "main";
@ -206,7 +206,7 @@ in
}; };
resource.hydra_jobset.nixos-staging-next-small = { resource.hydra_jobset.nixos-staging-next-small = {
project = config.resource.hydra_project.forkos.name; project = tf.ref "resource.hydra_project.forkos.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "nixos-staging-next-small"; name = "nixos-staging-next-small";
@ -246,7 +246,7 @@ in
}; };
resource.hydra_jobset.nixpkgs-staging-next = { resource.hydra_jobset.nixpkgs-staging-next = {
project = config.resource.hydra_project.forkos.name; project = tf.ref "resource.hydra_project.forkos.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "nixpkgs-staging-next"; name = "nixpkgs-staging-next";
@ -286,7 +286,7 @@ in
}; };
resource.hydra_jobset.nixos-main = { resource.hydra_jobset.nixos-main = {
project = config.resource.hydra_project.forkos.name; project = tf.ref "resource.hydra_project.forkos.name";
state = "enabled"; state = "enabled";
visible = true; visible = true;
name = "nixos-main"; name = "nixos-main";