Merge pull request #4216 from stack72/f-do-floatingip_read

provider/digitalocean: FloatingIP Read Func for Region
This commit is contained in:
James Nugent 2015-12-08 17:18:54 -05:00
commit 6e45319102
1 changed files with 4 additions and 5 deletions

View File

@ -82,11 +82,10 @@ func resourceDigitalOceanFloatingIpRead(d *schema.ResourceData, meta interface{}
return fmt.Errorf("Error retrieving FloatingIP: %s", err) return fmt.Errorf("Error retrieving FloatingIP: %s", err)
} }
if _, ok := d.GetOk("droplet_id"); ok { if floatingIp.Droplet != nil {
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) log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region.Slug)
d.Set("region", floatingIp.Droplet.Region.Slug) d.Set("region", floatingIp.Droplet.Region.Slug)
}
} else { } else {
d.Set("region", floatingIp.Region.Slug) d.Set("region", floatingIp.Region.Slug)
} }