Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Assign Existing Float IP to New Droplet #9353

Closed
miry opened this issue Oct 13, 2016 · 2 comments
Closed

Allow Assign Existing Float IP to New Droplet #9353

miry opened this issue Oct 13, 2016 · 2 comments

Comments

@miry
Copy link

miry commented Oct 13, 2016

Terraform Version

Terraform v0.7.4

Affected Resource(s)

Please list the resources as a list, for example:

  • digitalocean_floating_ip
  • digitalocean_droplet

There are no example describes how to assign existing Float Ip resource to new droplet. https://www.terraform.io/docs/providers/do/r/floating_ip.html

It would great to have similar solution as for aws_eip: https://www.terraform.io/docs/providers/aws/r/eip_association.html

Example:

resource "digitalocean_floating_ip_association" "ip_assoc" {
  instance_id = "${digitalocean_droplet.web.id}"
  allocation_id = "${digitalocean_floating_ip.example.id}"
}

or provide ip in digitalocean_droplet resource:

resource "digitalocean_droplet" "web" {
  ...
  float_ips = ["${digitalocean_floating_ip.example.id}"]
  ...
}
@kasperisager
Copy link

kasperisager commented Oct 27, 2016

This would be incredibly useful as it would allow Droplets to access the Floating IP during provisioning. I personally need this for a Consul deployment where each server node needs to advertise the address of its associated Floating IP. This allows me to effortlessly taint a failed server and simply let Terraform bring up a new one with same Floating IP and Volume attached as the old one.

Much like @miry, I'm envisioning something along the lines of:

resource "digitalocean_volume" "consul" {
  ...
}

resource "digitalocean_floating_ip" "consul" {
  ...
}

resource "digitalocean_droplet" "consul" {
  ...
  volume_ids = ["${digitalocean_volume.consul.id}"]
  floating_ip = "${digitalocean_floating_ip.consul.ip_address}"

  provisioner "file" {
    destination = "/etc/consul.d/server.json"
    content = <<EOF
    {
      "advertise_addr": "${self.floating_ip}"
    }
EOF
  }
}

I'm currently hacking my around this using a null_resource but it's not pretty.

@ghost
Copy link

ghost commented Apr 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants