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 <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-06-03 23:14:07 +00:00 committed by tazjin
parent 469189afd3
commit af44916312

View file

@ -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
'';
}