Fixing the digitalocean floatingip resource for a panic when droplet wasn't available
This commit is contained in:
parent
d69abbaeda
commit
4b5cb07475
|
@ -83,8 +83,10 @@ func resourceDigitalOceanFloatingIpRead(d *schema.ResourceData, meta interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := d.GetOk("droplet_id"); ok {
|
if _, ok := d.GetOk("droplet_id"); ok {
|
||||||
log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region)
|
if floatingIp.Droplet != nil {
|
||||||
d.Set("region", floatingIp.Droplet.Region.Slug)
|
log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region)
|
||||||
|
d.Set("region", floatingIp.Droplet.Region.Slug)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
d.Set("region", floatingIp.Region.Slug)
|
d.Set("region", floatingIp.Region.Slug)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue