CDKTF can't pass entire TerraformHclModule to another, need a output from that module

I have these 2 modules in the same stack, same constructor.

Example:

    const networkData = new TerraformHclModule(this, "network_data", {
      source: "git::https://project@dev.azure.com/repo/tf//some",
      variables: {
        client_abbrev: `${id}`
      }
    });
   ### this will error out: cyclic dependency issue 
   new TerraformHclModule(this, `nsg_rules_${locationValue}`, {
        source: path.resolve(__dirname, './somefile'),
        variables: {
          network_data: networkData,
        }
      });
    });
### error message:
Command output on stderr:

    /__w/71397/s/repo/cdktf/node_modules/cdktf/lib/errors.ts:501
      new Error(`Trying to 'resolve()' a Construct at '${pathName}'. 
      ^
    Error: Trying to 'resolve()' a Construct at '/module/nsg_rules/network_data/node'. 

    This often means an unintended cyclic dependency in your construct tree, leading to the resolution stuck in an infinite loop that fails.
    This can happen if the scope passed into this construct is also part of its subtree. 

    To resolve this issue, refactor your code to avoid this cyclic dependency by changing the scope of this construct.

However, this work, since i have output from networkdata:

   new TerraformHclModule(this, `nsg_rules_${locationValue}`, {
        source: path.resolve(__dirname, './somefile'),
        variables: {
          network_data: networkData.getString('all_outputs'),
        }
      });
    });

Can anyone please explain, why can’t pass entire module into another? (this works total fine in Terraform)

@ansgarm

The workaround is to pass the string, so it will render it and networkdata (entire module)

new TerraformHclModule(this, `nsg_rules_${locationValue}`, {
        source: path.resolve(__dirname, './somefile'),
        variables: {
          network_data: "${networkData}"
        }
      });
    });

[/quote]