From 22388139a3768492db346fabf24e937686d09ed1 Mon Sep 17 00:00:00 2001 From: stack72 Date: Tue, 8 Dec 2015 16:52:41 +0000 Subject: [PATCH] Changing the DigitalOcean FloatingIP Read func to check for Droplet Region and then fallback to FloatingIP Region --- .../digitalocean/resource_digitalocean_floating_ip.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go index bb8bee00b..06a3760f8 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go +++ b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go @@ -82,11 +82,10 @@ func resourceDigitalOceanFloatingIpRead(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error retrieving FloatingIP: %s", err) } - if _, ok := d.GetOk("droplet_id"); ok { - if floatingIp.Droplet != nil { - 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] A droplet was detected on the FloatingIP so setting the Region based on the Droplet") + log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region.Slug) + d.Set("region", floatingIp.Droplet.Region.Slug) } else { d.Set("region", floatingIp.Region.Slug) }