I'm trying to upgrade out Terraform seeing as 0.12 (stable) came out recently. I've ran into some issues with a certain pair of resource blocks. I'm getting the below error message when trying to do terraform plan, if I remove the count index it gives me a different error and says that I need the count index but that gives this error:
The "count" object can be used only in "resource" and "data" blocks, and only
when the "count" argument is set.
Here is the terraform stripped down to only the relevant parts.
resource "azurerm_network_interface" "network_interface" {
count = "${var.vm_server_count}"
location = "${var.location}"
}
}
Problematic resource block
resource "azurerm_network_interface_backend_address_pool_association" "network_interface" {
network_interface_id = "${azurerm_network_interface.network_interface[count.index]}"
ip_configuration_name = "example"
backend_address_pool_id = "${azurerm_lb_backend_address_pool.network_interface.id}"
}
What am I missing here? This is Terraform 0.12 stable using Azure as the provider.