Terraform and Floating IPs

Is there any plan (or have I missed it) to add floating IP/IP control to the Linode Terraform provider?

Our deployment model would be to build a new image using packer, then deploy a new server with this image and have the IP switched over from the old server to new - obviously possible via the UI/CLI but doesn't seem to be in terraform?

Alternatively (I haven't tried this yet) does the terraform provider retain the existing server when changing the image and simply re-launch on the new image (retaining it's existing IP).

Thanks

5 Replies

Hi @davelewthwaite!

The thoughts around this Terraform resource have been gathered in:

https://github.com/terraform-providers/terraform-provider-linode/issues/12#issuecomment-466858699

Please weigh in and Subscribe to that issue for updates.

There are complexities to the approach described there.

Let me know if you have thoughts on how the Terraform implementation of this resource should behave.

You might be on to a work-around..

resource "null_resource" "ip_swap" {
  depends_on = ["linode_instance.disposable_image", "linode_instance.target"]
  provisioner "local-exec" {
    command = "linode-cli networking ip-share ${linode_instance.target.id} ${linode_instance.disposable_image.ip_address}"

  }

  provisioner "remote-exec" {
    inline = [
      "ip a ${linode_instance.disposable_image.ip_address} dev eth0", 
      "... make it permanent and add routes"
    ]
    connection {
      host = "${linode_instance.target.ip_address}"
    }
  }
}

I assume you have seen that the Terraform provider also has Image support. You wouldn't need to use Packer unless you really wanted to:
https://www.terraform.io/docs/providers/linode/r/image.html

Hi Marques,

For the benefit of those finding this discussion on this channel - we've already got a heavy Packer investment and would like to utilise the same flow as we already use for AWS, OpenStack, DigitalOcean etc.

I'll follow up on the GitHub discussion.

Thanks

The Linode Packer Builder project is now homed in Linode's Github org. This will make it easier for us to maintain going forward (leading towards an eventual PR for inclusion in the upstream Packer project).

Please consider this a community supported (not officially supported), Work In Progress.

Any progress on this? It would certainly be trouble if we were regenerating our servers with Terraform and lost our current public IPs as a result! People would DNS to God knows where until we sorted that out!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct