digitalocean_floating_ip_assignment

Provides a resource for assigning an existing DigitalOcean Floating IP to a Droplet. This makes it easy to provision floating IP addresses that are not tied to the lifecycle of your Droplet.

Example Usage

resource "digitalocean_floating_ip" "foobar" {
  region = "sgp1"
}

resource "digitalocean_droplet" "foobar" {
  name               = "baz"
  size               = "s-1vcpu-1gb"
  image              = "ubuntu-18-04-x64"
  region             = "sgp1"
  ipv6               = true
  private_networking = true
}

resource "digitalocean_floating_ip_assignment" "foobar" {
  ip_address = digitalocean_floating_ip.foobar.ip_address
  droplet_id = digitalocean_droplet.foobar.id
}

Argument Reference

The following arguments are supported:

Import

Floating IP assignments can be imported using the Floating IP itself and the id of the Droplet joined with a comma. For example:

terraform import digitalocean_floating_ip_assignment.foobar 192.0.2.1,123456