Nested for_each with Terraform
Terraform provides a for_each iterator which allows you to loop over elements of a list, and perform an operation with each element. For example, to grant multiple permissions for myself on a Snowflake schema, I could do something like this: resource "snowflake_schema_grant" "write_permissions" { for_each = toset(["CREATE TABLE", "CREATE VIEW", "USAGE"]) database_name = "MY_DATABASE" privilege = each.key roles = "DAVE" schema_name = "MY_SCHEMA" } This loops over each element in the for_each list, and substitutes it as the privilege using each....