This function finds all data source instances of a specific type that are being created, modified, or read in the current plan using the tfplan/v2 import. Data sources with the "no-op" action are also included, but only if their change.after
attribute is not null.
When evaluating data sources that do not reference any computed values (those known after doing an apply), it is usually better to use the tfstate/v2 import and the corresponding find_datasources function that uses that import.
This function is contained in the tfplan-functions.sentinel Sentinel module.
find_datasources = func(type)
- type: the type of datasource to find, given as a string.
None
This function returns a single flat map of data source instances indexed by the complete addresses of the instances. The map is actually a filtered sub-collection of the tfplan.resource_changes
collection.
This function does not print anything.
Here are some examples of calling this function, assuming that the tfplan-functions.sentinel file that contains it has been imported with the alias plan
:
allAMIs = plan.find_datasources("aws_ami")
allImages = plan.find_datasources("azurerm_image")
allImages = plan.find_datasources("google_compute_image")
allDatastores = plan.find_datasources("vsphere_datastore")