Hi,
I have a definition for a Virtual Machine that is built using an image from the Azure marketplace.
The VM specifications are stored in some lists and the VM resource is built with a count iterating over the lists (Though I don’t think this is relevant to the issue).
The definition looks something like:
resource "azurerm_virtual_machine" "vms" {
count = length(var.vmnames)
storage_image_reference {
publisher = var.publisher
offer = var.offer
sku = var.sku
version = var.fw_versions[count.index]
}
From the documentation I can see on the azurerm_virtual_machine resource, it says that a change to the “version” value in the “storage_image_reference” block should cause the resource to be destroyed and re-created, which in this case is what I want.
This isn’t happening though. I can change that version value to anything I want and it never seems to trigger the re-creation. I’ve also tested by just not using a variable and inserting the version directly into the config block.
I can change other values in that block, like “offer” for example and that does indeed mark the VM for re-creation.
Have I overlooked something here?
Thanks