Skip to content

Commit bff46dd

Browse files
authored
fix: update issue on is_volume name update (IBM-Cloud#6127)
1 parent d9874c4 commit bff46dd

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

ibm/service/vpc/resource_ibm_is_volume.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -827,22 +827,22 @@ func volUpdate(d *schema.ResourceData, meta interface{}, id, name string, hasNam
827827
volumeNamePatchModel = &vpcv1.VolumePatch{}
828828
bandwidth := int64(d.Get("bandwidth").(int))
829829
volumeNamePatchModel.Bandwidth = &bandwidth
830+
volumeNamePatch, err := volumeNamePatchModel.AsPatch()
831+
if err != nil {
832+
return fmt.Errorf("[ERROR] Error calling asPatch for volumeNamePatch for bandwidth: %s", err)
833+
}
834+
options.VolumePatch = volumeNamePatch
835+
_, response, err = sess.UpdateVolume(options)
836+
if err != nil {
837+
return err
838+
}
839+
_, err = isWaitForVolumeAvailable(sess, d.Id(), d.Timeout(schema.TimeoutCreate))
840+
if err != nil {
841+
return err
842+
}
843+
eTag = response.Headers.Get("ETag")
844+
options.IfMatch = &eTag
830845
}
831-
volumeNamePatch, err := volumeNamePatchModel.AsPatch()
832-
if err != nil {
833-
return fmt.Errorf("[ERROR] Error calling asPatch for volumeNamePatch for bandwidth: %s", err)
834-
}
835-
options.VolumePatch = volumeNamePatch
836-
_, response, err = sess.UpdateVolume(options)
837-
if err != nil {
838-
return err
839-
}
840-
_, err = isWaitForVolumeAvailable(sess, d.Id(), d.Timeout(schema.TimeoutCreate))
841-
if err != nil {
842-
return err
843-
}
844-
eTag = response.Headers.Get("ETag")
845-
options.IfMatch = &eTag
846846
}
847847

848848
// profile/ iops update

0 commit comments

Comments
 (0)