Use case link/associate via module

Hi,
I am quite new of using Terraform. I have created several modules (nsg, subnet, vnet) and deploy the resources multiple times with different context via the for_each argument.

Now I want to link an Azure NSG to an Azure Subnet. How can I achieve this?

Thanks!