← IaC Academy

Values and collections · 12 / 23

Load a CSV catalogue

Turn a supplied CSV into a stable keyed resource collection.

YOUR TASK

Make this happen

3 steps
  1. Use code as the csv key.

  2. Repair the Shipping row in teams.csv.

  3. Inspect exactly two desired teams.

Read the starter files

main.cococo

team "departments" {
  for_each = csv({ path = "teams.csv", key = "code" })
  name = each.value.name
  description = each.value.description
}

teams.csv

code,name,description
packing,Packing,Packs orders
shipping,TODO,Ships orders