Iterate over set for resource using count and index in Terraform

Even in Terraform 0.12 you cannot use iteration with resources, so you may still have to resort to using count to create multiple resources.

However you cannot iterate over a set (unlike a list) normally because it has no indices. Luckily Terraform will convert sets to lists without modifying the order of items, which allows you to use count and index as you would with a list.

Add comment