Create new Azure VMs without replacing the existing ones

Hi Community,

I had created terraform code to deploy the Azure virtual desktops. The code is working fine and it is creating the VMs in Azure. However when i try to create new VMs, it is replacing the existing ones and redeploying them… Any guidance on how can I do incremental deployment?.

The code is here
resource “azurerm_windows_virtual_machine” “avd_vm” {
count = var.rdsh_count
name = “{var.prefix}-{count.index + 1}”
resource_group_name =
location = azurerm_resource_group.rg.location
size = var.vm_size
network_interface_ids = [“${azurerm_network_interface.avd_vm_nic.*.id[count.index]}”]
provision_vm_agent = true
admin_username = var.local_admin_username
admin_password = var.local_admin_password

os_disk {
name = “{lower(var.prefix)}-{count.index + 1}”
caching = “ReadWrite”
storage_account_type = “Standard_LRS”

Please see Guide to asking for help in this forum - supplying the extra information it asks for will enable your question to receive better answers - currently too much is unknown to make good recommendations.

Thanks @maxb :- I specified the section and tags to help reaching out to the proper team.

First, Welcome to the forum - please reformat your message

Second, please show the terraform plan output that is proposing to redeploy VMs.