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