Skip to content

Commit

Permalink
fix disk img bug
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed Aug 6, 2024
1 parent ca04b01 commit b98738f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion civo/instances/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ func resourceInstanceRead(_ context.Context, d *schema.ResourceData, m interface
return diag.Errorf("[ERR] failed to retriving the instance: %s", err)
}

diskImg, err := apiClient.GetDiskImageByName(resp.SourceID)
if err != nil {
return diag.Errorf("[ERR] failed to get the disk image: %s", err)
}

d.Set("hostname", resp.Hostname)
d.Set("reverse_dns", resp.ReverseDNS)
d.Set("size", resp.Size)
Expand All @@ -361,7 +366,7 @@ func resourceInstanceRead(_ context.Context, d *schema.ResourceData, m interface
d.Set("script", resp.Script)
d.Set("created_at", resp.CreatedAt.UTC().String())
d.Set("notes", resp.Notes)
d.Set("disk_image", resp.SourceID)
d.Set("disk_image", diskImg.ID)

if resp.PublicIP != "" {
d.Set("public_ip_required", "create")
Expand Down

0 comments on commit b98738f

Please sign in to comment.