resize server on flavor_id or flavor_name change
This commit is contained in:
parent
49b01a4f0a
commit
bb6969a4c5
|
@ -550,11 +550,15 @@ func resourceComputeInstanceV2Update(d *schema.ResourceData, meta interface{}) e
|
||||||
d.SetPartial("volume")
|
d.SetPartial("volume")
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("flavor_ref") {
|
if d.HasChange("flavor_id") || d.HasChange("flavor_name") {
|
||||||
resizeOpts := &servers.ResizeOpts{
|
flavorId, err := getFlavorID(computeClient, d)
|
||||||
FlavorRef: d.Get("flavor_ref").(string),
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
err := servers.Resize(computeClient, d.Id(), resizeOpts).ExtractErr()
|
resizeOpts := &servers.ResizeOpts{
|
||||||
|
FlavorRef: flavorId,
|
||||||
|
}
|
||||||
|
err = servers.Resize(computeClient, d.Id(), resizeOpts).ExtractErr()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error resizing OpenStack server: %s", err)
|
return fmt.Errorf("Error resizing OpenStack server: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue