2023-06-15 23:04:14 +02:00
|
|
|
{ tflib
|
|
|
|
, pkgs
|
|
|
|
, config
|
|
|
|
}:
|
|
|
|
{
|
|
|
|
name
|
|
|
|
, source
|
2023-06-29 18:58:27 +02:00
|
|
|
, ...
|
|
|
|
}@args:
|
2023-06-15 23:04:14 +02:00
|
|
|
{
|
|
|
|
source =
|
|
|
|
let
|
|
|
|
module = (tflib.mkTerranixConfiguration {
|
|
|
|
inherit pkgs;
|
|
|
|
modules = [
|
|
|
|
source
|
|
|
|
{
|
|
|
|
_file = "terraform-module.nix";
|
2023-06-22 23:25:49 +02:00
|
|
|
_module.args = builtins.removeAttrs config._module.args [ "pkgs" "tflib" ];
|
2023-06-15 23:04:14 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
} ).config.build.json;
|
|
|
|
in
|
|
|
|
pkgs.runCommandNoCC "${name}-module" {} ''
|
|
|
|
mkdir -p $out/
|
|
|
|
ln -s ${module} $out/main.tf.json
|
|
|
|
'';
|
2023-06-29 18:58:27 +02:00
|
|
|
} // builtins.removeAttrs args [ "name" "source" ]
|