about summary refs log tree commit diff
path: root/ops/glesys
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-06-03T23·15+0000
committertazjin <tazjin@tvl.su>2022-06-06T11·05+0000
commitfceb3fef7348545657fb6a748154fc2e1701e90d (patch)
tree4c59002d498cb4f34956523da75534756d020bd3 /ops/glesys
parentaf44916312ee8b1560490822dd6bdb03ff8e4f5f (diff)
test(ops/glesys): Validate Terraform configuration in CI r/4217
Change-Id: I8d251d3ee1de77feca865d0a677041c9c485d211
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5843
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'ops/glesys')
-rw-r--r--ops/glesys/default.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/ops/glesys/default.nix b/ops/glesys/default.nix
index 2dfb505fb423..80a86fec70c9 100644
--- a/ops/glesys/default.nix
+++ b/ops/glesys/default.nix
@@ -1,8 +1,17 @@
-{ depot, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
 
-depot.nix.readTree.drvTargets {
+depot.nix.readTree.drvTargets rec {
   # Provide a Terraform wrapper with the right provider installed.
   terraform = pkgs.terraform.withPlugins (_: [
     depot.third_party.terraform-provider-glesys
   ]);
+
+  validate = pkgs.runCommand "tf-validate-glesys"
+    {
+      GLESYS_TOKEN = "ci-dummy";
+    } ''
+    cp -r ${lib.cleanSource ./.}/* . && chmod -R u+w .
+    ${terraform}/bin/terraform init -upgrade -backend=false -input=false
+    ${terraform}/bin/terraform validate | tee $out
+  '';
 }