Are resources created concurrently with for_each meta-argument?

Looking at this example:

resource "azurerm_resource_group" "rg" {
  for_each = tomap({
    a_group       = "eastus"
    another_group = "westus2"
  })
  name     = each.key
  location = each.value
}

Dumb question, are these resources created sequentially or concurrently (I assume) by terraform core ?

I think it will use the same parallelism anything else does (you will want to search for what that value is). From a quick web search, I think the default for that is10. So, depending on your terraform settings, the other resources being created at the same time, any dependency relationships, etc., it should create them in parallel.

Side note: I don’t think you need the tomap() in this example.

Thanks.

Yes it’s 10.

By default, up to 10 nodes in the graph will be processed concurrently.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.