Comments (11)
I think this is a glaring omission in this provider. Setting up DNS ahead of time to point to a pregenerated floating IP address is a must for rapid deployment of servers.
from terraform-provider-digitalocean.
Running into the same issue. Correct me if I am wrong but, due to this, we currently have no means to retain a floating_ip upon the destruction of its currently allocated droplet?
from terraform-provider-digitalocean.
This should have the enhancements tag. I can't believe this has not been addressed since the original ticket in October 2016
from terraform-provider-digitalocean.
Hi,
This is an issue for me as well. Being able to point a new host to an existing floating IP would help get round an issue I raised in the main Terraform Git as well.
Regards,
Andy
from terraform-provider-digitalocean.
Is this going to be addressed at some point by any chance? I don't have time to pick it up right now but need it for a project at some point soon.
from terraform-provider-digitalocean.
@BradErz I don't think so. The original ticket was created on 13 Oct 2016: hashicorp/terraform#9353
from terraform-provider-digitalocean.
@eddiezane can you take a look to this issue?
from terraform-provider-digitalocean.
Hi all,
I am trying to better understand the issue here to determine if the problem is the lack of documentation or if there is a need for an enhancement as well.
In this minimal example, I've created two Droplets (foo and bar) and one floating IP attached to the first Droplet:
resource "digitalocean_droplet" "foo" {
image = "ubuntu-16-04-x64"
name = "terrform-droplet-foo"
region = "nyc3"
size = "s-1vcpu-1gb"
}
resource "digitalocean_droplet" "bar" {
image = "ubuntu-16-04-x64"
name = "terrform-droplet-bar"
region = "nyc3"
size = "s-1vcpu-1gb"
}
resource "digitalocean_floating_ip" "foobar" {
droplet_id = "${digitalocean_droplet.foo.id}"
region = "nyc3"
}
If I update the config to the below, the existing floating IP is moved from Droplet foo to Droplet bar.
resource "digitalocean_droplet" "foo" {
image = "ubuntu-16-04-x64"
name = "terrform-droplet-foo"
region = "nyc3"
size = "s-1vcpu-1gb"
}
resource "digitalocean_droplet" "bar" {
image = "ubuntu-16-04-x64"
name = "terrform-droplet-bar"
region = "nyc3"
size = "s-1vcpu-1gb"
}
resource "digitalocean_floating_ip" "foobar" {
droplet_id = "${digitalocean_droplet.bar.id}"
region = "nyc3"
}
Updating the config again to remove the droplet_id
attribute from the floating IP, I am successfully able to unassign the floating IP from either Droplet without destroying the floating IP.
resource "digitalocean_droplet" "foo" {
image = "ubuntu-16-04-x64"
name = "terrform-droplet-foo"
region = "nyc3"
size = "s-1vcpu-1gb"
}
resource "digitalocean_droplet" "bar" {
image = "ubuntu-16-04-x64"
name = "terrform-droplet-bar"
region = "nyc3"
size = "s-1vcpu-1gb"
}
resource "digitalocean_floating_ip" "foobar" {
region = "nyc3"
}
Is there a use case I am missing? It seems like a Floating IP datasource would probably be useful, but that doesn't seem to be what people are asking for here.
Thanks!
from terraform-provider-digitalocean.
@andrewsomething the issue to assign during float ip on create a new droplet.
resource "digitalocean_droplet" "bar" {
image = "ubuntu-16-04-x64"
name = "terrform-droplet-bar"
region = "nyc3"
size = "s-1vcpu-1gb"
float_ips = ["digitalocean_floating_ip.foobar.id"]
}
It seems floating ip now support assign droplet. the issue was created 2 years ago hashicorp/terraform#9353.
from terraform-provider-digitalocean.
Agreed - it's around how to assign an existing floating IP to a new server. Given the time it takes to set up DNS entries, I have created the DNS entries manually, then created the floating IP manually. That's so that they are not accidentally destroyed in any Terraform destroy process, as destroy doesn't allow you to exclude specific items when rebuilding the environment.
I then create the servers via Terraform as usual. But to get the non-terraform floating IP to point to the new Terraformed server, I have to hop out of Terraform and use a custom node script I wrote, which uses the DigitalOcean API.
Not a huge headache in terms of technical requirements, but just makes it a very disjointed process.
Hope that helps,
Andy
from terraform-provider-digitalocean.
I don't have time right now to write tests for it, but I believe I've implemented a new resource that meets this need.
See my fork: oliviabarrick@e739f5a
Allows assigning an already existing floating ip to a droplet via a new resource (fixes #8).
Adds a `digitalocean_floating_ip_assignment` resource so that a floating IP that
already exists can be assigned to a droplet.
I've also added the `ignore_droplet_id` flag to the `digitalocean_floating_ip` so that
the existing floating IP resource can be used to create these IPs.
A new resource was used to prevent circular dependencies.
Example usage:
provider "digitalocean" {
token = "${var.digitalocean_token}"
}
resource "digitalocean_floating_ip" "ip" {
region = "tor1"
ignore_droplet_id = true
}
resource "digitalocean_floating_ip_assignment" "ip" {
ip_address = "${digitalocean_floating_ip.ip.ip_address}"
droplet_id = "${element(digitalocean_droplet.my_droplet.*.id, 0)}"
}
resource "digitalocean_droplet" "my_droplet" {
count = 3
name = "example-${count.index}"
image = "debian-9-x64"
region = "tor1"
size = "s-1vcpu-1gb"
user_data = <<EOL
#cloud-config
runcmd:
- [ "ping", "${digitalocean_floating_ip.ip.ip_address}" ]
EOL
}
from terraform-provider-digitalocean.
Related Issues (20)
- `digitalocean_project` created on failure, absent from TF state HOT 2
- App Platform image credentials set as required HOT 3
- Dedicated egress IP addresses support for App platform
- digitalocean_spaces_bucket NoSuchBucket while creating bucket HOT 3
- digitalocean_kubernetes_cluster. to support database operator HOT 2
- Consider adding GPG key to OpenTofu registry for the digitalocean provider HOT 2
- Support for database fork
- digitalocean_firewall blocks all ports
- digitalocean_ssh_key race condition (roduced an unexpected new value: Root object was present, but now absent) HOT 1
- digitalocean_database_cluster password is always empty HOT 5
- functions: feature: add resource, and data source for functions and namespaces
- Add OpenSearch Documentation HOT 1
- digitalocean_app panic HOT 1
- digitalocean_app: support private docker repositories HOT 2
- digitalocean_app: Service Autoscaling
- Error creating droplet: JSON unmarshal issue with large number into Go struct field type int HOT 2
- Imported database replica attempting to resize to current configuration HOT 1
- digitalocean_app.alert does not support DEPLOYMENT_STARTED and DEPLOYMENT_CANCELLED
- Certificate not found on import of digitalocean_certificate HOT 2
- `DEPLOYMENT_STARTED` and `DEPLOYMENT_CANCELLED` missing from docs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-digitalocean.