From 4b5cb0747559aa070d2c6ec7975e6c6f5259c2ea Mon Sep 17 00:00:00 2001 From: stack72 Date: Tue, 8 Dec 2015 16:29:13 +0000 Subject: [PATCH] Fixing the digitalocean floatingip resource for a panic when droplet wasn't available --- .../digitalocean/resource_digitalocean_floating_ip.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go index 03e4b07467..bb8bee00ba 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go +++ b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go @@ -83,8 +83,10 @@ func resourceDigitalOceanFloatingIpRead(d *schema.ResourceData, meta interface{} } if _, ok := d.GetOk("droplet_id"); ok { - log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region) - d.Set("region", floatingIp.Droplet.Region.Slug) + if floatingIp.Droplet != nil { + log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region) + d.Set("region", floatingIp.Droplet.Region.Slug) + } } else { d.Set("region", floatingIp.Region.Slug) }