← IaC Academy

Values and collections · 11 / 23

Create a keyed collection

Manage two teams with stable keys rather than positional copies.

YOUR TASK

Make this happen

3 steps
  1. Use keys packing and shipping with values Packing and Shipping.

  2. Keep name = each.value.

  3. Inspect two creates and then two no-ops.

Read the starter files

main.cococo

team "departments" {
  for_each = { packing = "Packing", shipping = "TODO" }
  name = each.value
  description = "Production department"
}