-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force recreation if storage_data_disk.creation_option changes (#218) #240
Conversation
Azure Resource Manager API doesn't support changes to this field. It should recreate the virtual machine and attach the disks again. module.xpto.azurerm_virtual_machine.prometheus_virtual_machine: Modifying... (ID: /subscriptions/xxxxx...ute/virtualMachines/vm) delete_data_disks_on_termination: "" => "false" delete_os_disk_on_termination: "" => "true" storage_data_disk.0.create_option: "Empty" => "Attach" storage_data_disk.1.create_option: "Empty" => "Attach" tags.%: "0" => "1" tags.role: "" => "xpto" Error applying plan: 1 error(s) occurred: * module.xpto.azurerm_virtual_machine.vm: 1 error(s) occurred: * azurerm_virtual_machine.prometheus_virtual_machine: compute.VirtualMachinesClient#CreateOrUpdate: Failure responding to request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=409 Code="PropertyChangeNotAllowed" Message="Changing property 'dataDisk.createOption' is not allowed."
Tests pass:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than 1 suggestion this LGTM.
Config: postConfig, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMVirtualMachineExists("azurerm_virtual_machine.test", &afterUpdate), | ||
testAccCheckVirtualMachineRecreated(t, &afterCreate, &afterUpdate), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a state check for the field that's being patched in this PR, just for sanity...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Updated tests:
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
Re-opening #218
Rebased and added a commit to the end of #218 which apparently closed the original PR - re-opening this here
Original issue body from #218:
I'm not sure how to test this change, please provide any feedback to help me with it.
Azure Resource Manager API doesn't support changes to this field. It
should recreate the virtual machine and attach the disks again.
Actual Behaviour:
module.xpto.azurerm_virtual_machine.prometheus_virtual_machine:
Modifying... (ID: /subscriptions/xxxxx...ute/virtualMachines/vm)
delete_data_disks_on_termination: "" => "false"
delete_os_disk_on_termination: "" => "true"
storage_data_disk.0.create_option: "Empty" => "Attach"
storage_data_disk.1.create_option: "Empty" => "Attach"
tags.%: "0" => "1"
tags.role: "" => "xpto"
Error applying plan:
1 error(s) occurred:
module.xpto.azurerm_virtual_machine.vm: 1 error(s) occurred:
azurerm_virtual_machine.prometheus_virtual_machine:
compute.VirtualMachinesClient#CreateOrUpdate: Failure responding to
request: StatusCode=409 -- Original Error: autorest/azure: Service
returned an error. Status=409 Code="PropertyChangeNotAllowed"
Message="Changing property 'dataDisk.createOption' is not allowed."