Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.82 KB

File metadata and controls

34 lines (23 loc) · 1.82 KB

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.

Sentinel Module

This function is contained in the tfplan-functions.sentinel Sentinel module.

Declaration

find_datasources = func(type)

Arguments

  • type: the type of datasource to find, given as a string.

Common Functions Used

None

What It Returns

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.

What It Prints

This function does not print anything.

Examples

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")