dotfiles/terranix/lib/terraform-module.nix
Magic_RB cb22a44b9d
Fix tflib getting redefined in terranix submodules
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2023-06-22 23:25:49 +02:00

28 lines
505 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" "tflib" ];
}
];
} ).config.build.json;
in
pkgs.runCommandNoCC "${name}-module" {} ''
mkdir -p $out/
ln -s ${module} $out/main.tf.json
'';
}