Interview Prep/Terraform/Loops, Conditionals, Dynamic Blocks and Functions

What do `count.index`, `each.key` and `each.value` mean?

BeginnerConceptLoops, Conditionals, Dynamic Blocks and Functions
Answer

count.index is the zero-based position when count is used. With for_each over a map, each.key is the map key and each.value the element; over a set, key and value are both the string. They are only valid inside the resource or module that uses the meta-argument.

All Terraform questions Roadmap: Terraform

More on Loops, Conditionals, Dynamic Blocks and Functions