Terraform 0.12 introduces a new construct called a for expression, which allows the construction of a list or map by transforming and filtering elements in another list or map. The example below shows this in use:https://youtu.be/q2ddojN9h8o
Terraform Doc: https://www.hashicorp.com/blog/hashicorp-terraform-0-12-preview-for-and-for-each