2 min read
Let's imagine we have the following data structure:
locals {
queries = [
{
query = "SELECT version()"
engine = "postgresql"
},
{
query = "SELECT * FROM v$version"
engine = "oracle"
},
(...)
]
}
If we want to use just some of the items on a resource we can use for_each through the resulting array of filtering the objects using a for:
for_each = [ for item in local.queries: item if item.engine == "postgresql" ]
22/06/2021
Read more...