Skip to content

Commit

Permalink
Fix disk_image and public_ip_required in instance read (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed Jun 13, 2024
1 parent b57a742 commit 5856862
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions civo/instances/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,16 @@ func resourceInstanceRead(_ context.Context, d *schema.ResourceData, m interface
d.Set("reserved_ipv4", resp.ReservedIP)
d.Set("created_at", resp.CreatedAt.UTC().String())
d.Set("notes", resp.Notes)
d.Set("disk_image", resp.SourceID)

if _, ok := d.GetOk("template"); ok {
d.Set("template", d.Get("template").(string))
if resp.PublicIP != "" {
d.Set("public_ip_required", "create")
} else {
d.Set("public_ip_required", "none")
}

if _, ok := d.GetOk("disk_image"); ok {
d.Set("disk_image", d.Get("disk_image").(string))
if _, ok := d.GetOk("template"); ok {
d.Set("template", d.Get("template").(string))
}

return nil
Expand Down

0 comments on commit 5856862

Please sign in to comment.