From af44916312ee8b1560490822dd6bdb03ff8e4f5f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 3 Jun 2022 23:14:07 +0000 Subject: test(ops/buildkite): Validate Terraform configuration in CI Change-Id: Ieef4d7d0a717107ee67432474683f3344b6561f8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5842 Tested-by: BuildkiteCI Reviewed-by: sterni --- ops/buildkite/default.nix | 13 +++++++++++-- 1 file 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 + ''; } -- cgit 1.4.1