diff --git a/azurerm/internal/services/compute/linux_virtual_machine_resource.go b/azurerm/internal/services/compute/linux_virtual_machine_resource.go index 14b122fb0424a..d9d2d62fbe4c7 100644 --- a/azurerm/internal/services/compute/linux_virtual_machine_resource.go +++ b/azurerm/internal/services/compute/linux_virtual_machine_resource.go @@ -642,7 +642,7 @@ func resourceLinuxVirtualMachineUpdate(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error retrieving InstanceView for Linux Virtual Machine %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } - shouldTurnBackOn := shouldBootVirtualMachine(instanceView) + shouldTurnBackOn := virtualMachineShouldBeStarted(instanceView) hasEphemeralOSDisk := false if props := existing.VirtualMachineProperties; props != nil { if storage := props.StorageProfile; storage != nil { diff --git a/azurerm/internal/services/compute/virtual_machine.go b/azurerm/internal/services/compute/virtual_machine.go index 2dafe26345ac4..80e008595f834 100644 --- a/azurerm/internal/services/compute/virtual_machine.go +++ b/azurerm/internal/services/compute/virtual_machine.go @@ -292,7 +292,7 @@ func virtualMachineOSDiskSchema() *schema.Schema { Type: schema.TypeInt, Optional: true, Computed: true, - ValidateFunc: validation.IntBetween(0, 1023), + ValidateFunc: validation.IntBetween(0, 2048), }, "name": { diff --git a/azurerm/internal/services/compute/virtual_machine_instance.go b/azurerm/internal/services/compute/virtual_machine_instance.go index 087186e201997..fdd11cf97e8c8 100644 --- a/azurerm/internal/services/compute/virtual_machine_instance.go +++ b/azurerm/internal/services/compute/virtual_machine_instance.go @@ -6,11 +6,11 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" ) -// shouldBootVirtualMachine determines if the Virtual Machine should be started after +// virtualMachineShouldBeStarted determines if the Virtual Machine should be started after // the Virtual Machine has been shut down for maintenance. This means that Virtual Machines // which are already stopped can be updated but will not be started // nolint: deadcode unused -func shouldBootVirtualMachine(instanceView compute.VirtualMachineInstanceView) bool { +func virtualMachineShouldBeStarted(instanceView compute.VirtualMachineInstanceView) bool { if instanceView.Statuses != nil { for _, status := range *instanceView.Statuses { if status.Code == nil { @@ -24,11 +24,7 @@ func shouldBootVirtualMachine(instanceView compute.VirtualMachineInstanceView) b } state = strings.TrimPrefix(state, "powerstate/") - switch strings.ToLower(state) { - case "deallocating": - case "deallocated": - case "stopped": - case "stopping": + if strings.EqualFold(state, "running") { return true } } diff --git a/azurerm/internal/services/compute/virtual_machine_scale_set.go b/azurerm/internal/services/compute/virtual_machine_scale_set.go index 17c8fda1b9ef6..385a7c7333228 100644 --- a/azurerm/internal/services/compute/virtual_machine_scale_set.go +++ b/azurerm/internal/services/compute/virtual_machine_scale_set.go @@ -937,7 +937,7 @@ func VirtualMachineScaleSetOSDiskSchema() *schema.Schema { Type: schema.TypeInt, Optional: true, Computed: true, - ValidateFunc: validation.IntBetween(0, 1023), + ValidateFunc: validation.IntBetween(0, 2048), }, "write_accelerator_enabled": { diff --git a/azurerm/internal/services/compute/windows_virtual_machine_resource.go b/azurerm/internal/services/compute/windows_virtual_machine_resource.go index 0955a7bea4834..b32bd39c1c3b4 100644 --- a/azurerm/internal/services/compute/windows_virtual_machine_resource.go +++ b/azurerm/internal/services/compute/windows_virtual_machine_resource.go @@ -667,7 +667,7 @@ func resourceWindowsVirtualMachineUpdate(d *schema.ResourceData, meta interface{ return fmt.Errorf("Error retrieving InstanceView for Windows Virtual Machine %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } - shouldTurnBackOn := shouldBootVirtualMachine(instanceView) + shouldTurnBackOn := virtualMachineShouldBeStarted(instanceView) hasEphemeralOSDisk := false if props := existing.VirtualMachineProperties; props != nil { if storage := props.StorageProfile; storage != nil {