This commit is contained in:
asteam
2025-07-31 16:10:50 +03:00
parent 1b81a71504
commit bae25296bb
4 changed files with 94 additions and 109 deletions

View File

@@ -111,6 +111,16 @@ func utilityComputeResize(ctx context.Context, d *schema.ResourceData, m interfa
c := m.(*controller.ControllerCfg)
computeId, _ := strconv.ParseUint(d.Id(), 10, 64)
if d.Get("started").(bool) {
stopReq := compute.StopRequest{
ComputeID: computeId,
Force: false,
}
if _, err := c.CloudBroker().Compute().Stop(ctx, stopReq); err != nil {
return err
}
}
resizeReq := compute.ResizeRequest{
ComputeID: computeId,
}
@@ -166,6 +176,12 @@ func utilityComputeResize(ctx context.Context, d *schema.ResourceData, m interfa
}
}
if d.Get("started").(bool) {
if _, err := c.CloudBroker().Compute().Start(ctx, compute.StartRequest{ComputeID: computeId}); err != nil {
return err
}
}
return nil
}