Terraform

Demonstrate how to use the for_each loop

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

resource “google_compute_instance” “instances” {

  for_each = var.names_map
  name = each.value
}