dotfiles/terranix/lib/terraform-module.nix
Magic_RB 9b1c305c3b Base terranix configuration
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2023-06-16 16:11:19 +02:00

28 lines
497 B
Nix

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