Terraform | The "count" object can be used only in "resource" and "data" blocks,
The resource "azurerm_network_interface_backend_address_pool_association" "network_interface" block doesn't have the count argument set, so count.index is not meaningful in that block.

Given the specific pair of resource types you're using here, I expect your intent was to create one association for each network interface, in which case you'd add the following count argument to the second block:

  count = length(azurerm_network_interface.network_interface)


Although this didn't return an error on Terraform 0.11, it did not behave as I expect you intended: it would've created only one azurerm_network_interface_backend_address_pool_association for the first network interface, and left the others unassociated.



If associating only the first one was your intent instead, then replace the count.index in the second block with 0 to be explicit that it's using only the first one:

  network_interface_id    = azurerm_network_interface.network_interface[0]