Cloud/Terraform/ForLoop

Loop over LIST/MAP gen MAP

{for <ITEM> in <LIST> : <OUTPUT_KEY> => <OUTPUT_VALUE>}

{for <KEY>, <VALUE> in <MAP> : <OUTPUT_KEY> => <OUTPUT_VALUE>}

Loop over LIST/MAP gen LIST

[for <ITEM> in <LIST> : <OUTPUT>]

[for <KEY>, <VALUE> in <MAP> : <OUTPUT>]

Merge List of Map(dict) into single MAP

* https://developer.hashicorp.com/terraform/language/functions/merge

* e.g. 1

> merge([{a="b", c="d"}, {}, {e="f", c="z"}]...)
{
  "a" = "b"
  "c" = "z"
  "e" = "f"
}

Flatten

Nested for loops

Variable validation on list

Uniq

Cloud/Terraform/ForLoop (last edited 2024-08-16 03:14:57 by PieterSmit)