Terraform get list index on for_each December 19, 2023 by Tarik Found an easy solution using the index function: tags = { Name = "Company0${index(var.vpc_cidrs, each.value) + 1}" }