Migration from floating to reserved IPs #844
-
Hello, I've updated to the latest version of this provider. Is there a safe way to migrate from former floating IP resources to reserved ones without losing the assigned IPv4 addresses? I've tested it by just renaming them in all Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you are using v2.21.0 of the provider, the Starting from a config like: resource "digitalocean_floating_ip" "foobar" {
region = "nyc1"
}
resource "digitalocean_droplet" "foobar" {
name = "foobar"
size = "s-1vcpu-1gb"
image = "ubuntu-20-04-x64"
region = "nyc1"
}
resource "digitalocean_floating_ip_assignment" "foobar" {
ip_address = digitalocean_floating_ip.foobar.ip_address
droplet_id = digitalocean_droplet.foobar.id
}
There are probably a few different ways to accomplish this. The most important part is removing the floating IP from the state before running an apply in order to retain the existing IP address. You don't want to delete the floating IP as it is the same as deleting the reserved IP. |
Beta Was this translation helpful? Give feedback.
If you are using v2.21.0 of the provider, the
digitalocean_floating_ip
resource has been updated to use theapi.digitalocean.com/v2/reserved_ips
endpoints under the hood. So no immediate action is needed. That said, we will likely deprecate it at some point in the future to reduce code duplication and prevent new users from mistakenly choosing the wrong resource.Starting from a config like: