dotfiles/terranix/lib/terraform-module.nix
Magic_RB 158ffab7c5
Allow for arbitrary arguments to nomadJob and terraformModule
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2023-06-29 18:58:27 +02:00

29 lines
565 B
Nix

{ tflib
, pkgs
, config
}:
{
name
, source
, ...
}@args:
{
source =
let
module = (tflib.mkTerranixConfiguration {
inherit pkgs;
modules = [
source
{
_file = "terraform-module.nix";
_module.args = builtins.removeAttrs config._module.args [ "pkgs" "tflib" ];
}
];
} ).config.build.json;
in
pkgs.runCommandNoCC "${name}-module" {} ''
mkdir -p $out/
ln -s ${module} $out/main.tf.json
'';
} // builtins.removeAttrs args [ "name" "source" ]