This function finds all data sources in a specific module in the Terraform configuration of the current plan's workspace using the tfconfig/v2 import.
This function is contained in the tfconfig-functions.sentinel module.
find_datasources_in_module = func(module_address)
- module_address: the address of the module containing data sources to find, given as a string. The root module is represented by "". A module named
network
called by the root module is represented by "module.network". if that module contained a module namedsubnets
, it would be represented by "module.network.module.subnets".
None
This function returns a single flat map of data sources indexed by the complete addresses of the data sources (excluding indices representing their counts). The map is actually a filtered sub-collection of the tfconfig.resources
collection.
This function does not print anything.
Here are some examples of calling this function, assuming that the tfconfig-functions.sentinel file that contains it has been imported with the alias config
:
allRootModuleDatasources = config.find_datasources_in_module("")
allNetworkDatasources = config.find_datasources_in_module("module.network")