mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-06 05:53:58 +00:00
fix(vm): do not reboot VM on config change if it is not running (#430)
This commit is contained in:
parent
a1d76441d5
commit
0281bc83e2
@ -5035,6 +5035,12 @@ func vmUpdateDiskLocationAndSize(
|
|||||||
|
|
||||||
// Perform a regular reboot in case it's necessary and haven't already been done.
|
// Perform a regular reboot in case it's necessary and haven't already been done.
|
||||||
if reboot {
|
if reboot {
|
||||||
|
vmStatus, err := vmAPI.GetVMStatus(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if vmStatus.Status != "stopped" {
|
||||||
rebootTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutReboot).(int)
|
rebootTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutReboot).(int)
|
||||||
|
|
||||||
err := vmAPI.RebootVM(
|
err := vmAPI.RebootVM(
|
||||||
@ -5048,6 +5054,7 @@ func vmUpdateDiskLocationAndSize(
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return vmRead(ctx, d, m)
|
return vmRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user