When using the
azurerm_virtual_machine_scale_set resource in your terraform configuration and you run into a crash with an error similar to this:
2022-03-07T14:59:03Z !!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!! . . . 2022-03-07T14:59:03Z * module.mymodulename.azurerm_virtual_machine_scale_set.main: 1 error occurred: 2022-03-07T14:59:03Z * module.mymodulename.azurerm_virtual_machine_scale_set.main: azurerm_virtual_machine_scale_set.main: unexpected EOF . . . 2022-03-07T14:59:03Z panic: runtime error: invalid memory address or nil pointer dereference
You're likely to see a crash like this if you're using the now deprecated
azurerm_virtual_machine_scale_set resource with newer/unsupported features of other resources and since the Azure API doesn't support such operations, Terraform crashed.
The resource last updated in provider v2.50 (data source in v2.57), The
azurerm_virtual_machine_scale_set resource is now feature-frozen and has been replaced with 2 new resources:
azurerm_windows_virtual_machine_scale_set. Per our registry website documentation:
The azurerm_virtual_machine_scale_set resource has been superseded by the azurerm_linux_virtual_machine_scale_set and azurerm_windows_virtual_machine_scale_set resources. The existing azurerm_virtual_machine_scale_set resource will continue to be available throughout the 2.x releases however is in a feature-frozen state to maintain compatibility - new functionality will instead be added to the azurerm_linux_virtual_machine_scale_set and azurerm_windows_virtual_machine_scale_set resources.
You can also find more explanation regarding this from our provider Engineers here.
The solution to get out of this bind requires that you replace the old
azurerm_virtual_machine_scale_set with either of the 2 new resources as suits your use-case:
Please note that from AzureRM provider v2.86 onwards, the
azurerm_linux/windows_virtual_machine_scale_setresources will be using only the Uniform Orchestration Mode.
- If you're on an AzureRM 1.x release, please note that the new scale set resources were released in v2.0, so you'll need to upgrade your provider to implement the fix. Please see this link for the Upgrade guide to v2.0.
Please also note that as a Support organization we no longer assist with AzureRM 1.x releases because it is now EOL (End Of Life). Please see this link for our general EOL policies.
Hope that helps. Thank you.