2015-11-04 12:37:33 +01:00
---
layout: "digitalocean"
page_title: "DigitalOcean: digitalocean_floating_ip"
sidebar_current: "docs-do-resource-floating-ip"
description: |-
Provides a DigitalOcean Floating IP resource.
---
# digitalocean\_floating_ip
Provides a DigitalOcean Floating IP to represent a publicly-accessible static IP addresses that can be mapped to one of your Droplets.
## Example Usage
2017-04-17 12:17:54 +02:00
```hcl
2015-11-04 12:37:33 +01:00
resource "digitalocean_droplet" "foobar" {
2017-02-18 23:48:50 +01:00
name = "baz"
size = "1gb"
image = "centos-5-8-x32"
region = "sgp1"
ipv6 = true
private_networking = true
2015-11-04 12:37:33 +01:00
}
resource "digitalocean_floating_ip" "foobar" {
2017-02-18 23:48:50 +01:00
droplet_id = "${digitalocean_droplet.foobar.id}"
region = "${digitalocean_droplet.foobar.region}"
2015-11-04 12:37:33 +01:00
}
```
## Argument Reference
The following arguments are supported:
2015-11-23 13:50:35 +01:00
* `region` - (Required) The region that the Floating IP is reserved to.
2015-11-04 12:37:33 +01:00
* `droplet_id` - (Optional) The ID of Droplet that the Floating IP will be assigned to.
~> **NOTE:** A Floating IP can be assigned to a region OR a droplet_id. If both region AND droplet_id are specified, then the Floating IP will be assigned to the droplet and use that region
## Attributes Reference
The following attributes are exported:
* `ip_address` - The IP Address of the resource
2016-07-19 18:22:30 +02:00
## Import
2017-02-18 23:48:50 +01:00
Floating IPs can be imported using the `ip` , e.g.
2016-07-19 18:22:30 +02:00
```
terraform import digitalocean_floating_ip.myip 192.168.0.1
```