Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.48 KB

File metadata and controls

34 lines (23 loc) · 1.48 KB

This function finds all data source instances of a specific type in the state of the current workspace using the tfstate/v2 import.

Sentinel Module

This function is contained in the tfstate-functions.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 tfstate.resources collection.

What It Prints

This function does not print anything.

Examples

Here are some examples of calling this function, assuming that the tfstate-functions.sentinel file that contains it has been imported with the alias state:

currentAMIs = state.find_datasources("aws_ami")

currentImages = state.find_datasources("azurerm_image")

currentImages = state.find_datasources("google_compute_image")

currentDatastores = state.find_datasources("vsphere_datastore")

This function is used by the restrict-ami-owners.sentinel (AWS) policy.