about summary refs log tree commit diff
path: root/ops/buildkite
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-06-03T23·14+0000
committertazjin <tazjin@tvl.su>2022-06-06T11·05+0000
commitaf44916312ee8b1560490822dd6bdb03ff8e4f5f (patch)
treef2ac1767b4ae4d1a4a3a7b0b7f358c16ac31f3ba /ops/buildkite
parent469189afd3ac362b947cccb00d659d8debb11e22 (diff)
test(ops/buildkite): Validate Terraform configuration in CI r/4216
Change-Id: Ieef4d7d0a717107ee67432474683f3344b6561f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5842
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'ops/buildkite')
-rw-r--r--ops/buildkite/default.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/ops/buildkite/default.nix b/ops/buildkite/default.nix
index f085bc6d9780..46c20e4a5f93 100644
--- a/ops/buildkite/default.nix
+++ b/ops/buildkite/default.nix
@@ -1,7 +1,16 @@
-{ depot, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
 
-depot.nix.readTree.drvTargets {
+depot.nix.readTree.drvTargets rec {
   terraform = pkgs.terraform.withPlugins (p: [
     p.buildkite
   ]);
+
+  validate = pkgs.runCommand "tf-validate-buildkite"
+    {
+      BUILDKITE_API_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
+  '';
 }