Question
How to assign floating ip address using terraform?
I’m unable to join floating ip and droplet creation.
# I create a resource:
resource "digitalocean_droplet" "mail" {
image = "centos-7-x64"
name = "mail"
region = "${var.region}"
size = "2gb"
private_networking = true
}
#I create a floating ip:
resource "digitalocean_floating_ip" "mail" {
droplet_id = "${digitalocean_droplet.mail.id}"
region = "${var.region}"
}
The IDs are the same, but the IP’s are not.
$ doctl compute droplet list
ID Name Public IPv4 Public IPv6 Memory VCPUs Disk Region Image Status Tags
38296000 mail 188.166.174.104 2048 2 40 lon1 CentOS 7.3.1611 x64 active
$ doctl compute fip list
IP Region Droplet ID Droplet Name
67.207.68.145 lon1 38296000 mail
How do I get the droplet to take the floating IP address?
Thanks,
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×