depot/ops/vault/cfg/default.nix

21 lines
532 B
Nix

{ pkgs, depotRoot, ... }@args:
let
terranix = import "${pkgs.terranix}/core/default.nix" {
inherit pkgs;
terranix_config = { imports = [ ./config.nix ]; };
strip_nulls = true;
extraArgs = args;
};
config = (pkgs.formats.json { }).generate "config.tf.json" terranix.config;
terraform = pkgs.writeShellScript "terraform" ''
cd ${depotRoot}/ops/vault/cfg/tf
rm ./config.tf.json
ln -s ${config} config.tf.json
exec ${pkgs.terraform}/bin/terraform "$@"
'';
in {
inherit config terraform;
}