-
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
Support for windows_virtual_machine license_type change without force replacement #7192
Comments
Thanks for opening this issue! By playing with azure CLI, I found this upgrade of As a valid workaround, terraform previously using |
Not sure about the Azure CLI but in general I think there shouldn’t be an issue with changing back and forward as often as one would like. I am currently on vacation but might give it a short test next week. Otherwise might open a case with Microsoft as well since it is either an issue in their documentation or an issue with the Azure CLI/ API |
Hi @ArcturusZhang so I checked using the Portal, started out with a machine without license, so the machine started out with "licenseType": null or not set in the resource explorer. I then added a license and "licenseType" was then set to "Windows_Server" and the API confirmed the change with 200 OK Then again I changed back to none, now obviously the licensetype got changed to "None" rather than not set. But the general function is working and the API also confirmed this with 200 OK. I haven't yet checked this with the CLI since I didn't have the time yet. |
Actually in my test, CLI would work the same, it just returned no error but the licenseType is not actually changed. Could you please confirm whether the licenseType could change from |
Thanks for the update! @AndreasMWalter . I will be working on this very soon |
@ArcturusZhang any updates on this issue? |
Hi together, because we need this functionality immediately I have worked on implementing an update functionality. Basically this would be following changes:
Updating from I think there are two options to handle this issue:
@ArcturusZhang: Do you have already looked into this problem? Then a short answer here would be great. |
Tested, this would work:
|
This has been released in version 2.29.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.29.0"
}
# ... other configuration ... |
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 👉 [email protected]. Thanks! |
Community Note
Description
Remove the need to redeploy the VM when changing OS licensing on Windows Virtual Machine.
Changing the license type of a Windows virtual machine can be done online using the portal (or Powershell and CLI for that matter) without replacement of the resource, Terraform however will redeploy the machine rather than update in place.
New or Affected Resource(s)
(possible that other services offer the same hybrid activation, but force replacement?)
Potential Terraform Configuration
Unchanged
References
https://docs.microsoft.com/de-de/azure/virtual-machines/windows/hybrid-use-benefit-licensing
https://www.terraform.io/docs/providers/azurerm/r/windows_virtual_machine.html#license_type
The text was updated successfully, but these errors were encountered: