From 7a1b78593b9c10fe18b4ddb453d0dbdedf970495 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Wed, 29 Jun 2016 16:05:36 +0100 Subject: [PATCH] provider/digitalocean: Reassign Floating IP when droplet changes (#7411) Fixes #6673 When a floating IP is changed in the DO console, this PR will allow it to be reassociated to the machine that Terraform attached it to and change it back --- .../providers/digitalocean/resource_digitalocean_floating_ip.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go index cdfc280385..1479ecfa50 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go +++ b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go @@ -122,6 +122,8 @@ func resourceDigitalOceanFloatingIpRead(d *schema.ResourceData, meta interface{} 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) + d.Set("droplet_id", floatingIp.Droplet.ID) + } else { d.Set("region", floatingIp.Region.Slug) }