Skip to content

Commit

Permalink
fix(Instance/Volume): size_in_db should not be set when importing vol…
Browse files Browse the repository at this point in the history
…ume (#837)
  • Loading branch information
jeansebastienh committed May 20, 2021
1 parent c4c6547 commit 9a7ffbe
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 111 deletions.
7 changes: 6 additions & 1 deletion scaleway/resource_instance_volume.go
Expand Up @@ -134,7 +134,12 @@ func resourceScalewayInstanceVolumeRead(ctx context.Context, d *schema.ResourceD
_ = d.Set("project_id", res.Volume.Project)
_ = d.Set("zone", string(zone))
_ = d.Set("type", res.Volume.VolumeType.String())
_ = d.Set("size_in_gb", int(res.Volume.Size/scw.GB))

_, fromVolume := d.GetOk("from_volume_id")
_, fromSnapshot := d.GetOk("from_snapshot_id")
if !fromSnapshot && !fromVolume {
_ = d.Set("size_in_gb", int(res.Volume.Size/scw.GB))
}

if res.Volume.Server != nil {
_ = d.Set("server_id", res.Volume.Server.ID)
Expand Down

0 comments on commit 9a7ffbe

Please sign in to comment.