• terraform: Using for_each over tuples

    2 min read

    terraform for_each tuple

    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...

From pet to cattle
Treat your kubernetes clusters like cattle, not pets