How can I access the name of the parent/calling module from within its child module.
Alternatively how can I get the filename of the calling module from within its child module?
e.g.
module "test_parent_module" {
source = "./child_module"
}
module "child_module" {
locals {
// What could I use here to get parent module name?
parent_module_name = module.parent # Should output "test_parent_module"
// What could I use here to get the parent module's file name?
parent_file_name = module.parent.filename # Should output "test_parent_module.tf"
}
}
Thanks