Right now it’s not possible to achieve that.
There were previous discussions on github about the same topic in the following issues:
- https://github.com/hashicorp/terraform/issues/5480
- https://github.com/hashicorp/terraform/issues/4585
- https://github.com/hashicorp/terraform/issues/2714
- https://github.com/hashicorp/terraform/issues/1742
- https://github.com/hashicorp/terraform/issues/1478
TL;DR
the sharing of variables between modules is against terraform core clarity/explicity principles.
Workaround
A workaround is to have the *shared*
files in the parent directory and using symlinks to add them to the modules.