about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-06-03T23·15+0000
committertazjin <tazjin@tvl.su>2022-06-06T11·05+0000
commit89ba82005917edcfc6ead10c254bdffbc659272a (patch)
tree04a9eb96f13736fd79e94a53fa8a7b5a1b12ba64
parentfceb3fef7348545657fb6a748154fc2e1701e90d (diff)
test(ops/keycloak): Validate Terraform configuration in CI r/4218
Change-Id: I5602cf722b9fe9502c9d7610eefc7ba0ab647362
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5844
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
-rw-r--r--ops/keycloak/default.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/ops/keycloak/default.nix b/ops/keycloak/default.nix
index 5757debd1..ef95c7290 100644
--- a/ops/keycloak/default.nix
+++ b/ops/keycloak/default.nix
@@ -1,8 +1,14 @@
-{ 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 (p: [
     p.keycloak
   ]);
+
+  validate = pkgs.runCommand "tf-validate-keycloak" { } ''
+    cp -r ${lib.cleanSource ./.}/* . && chmod -R u+w .
+    ${terraform}/bin/terraform init -upgrade -backend=false -input=false
+    ${terraform}/bin/terraform validate | tee $out
+  '';
 }