Closed marcelbrueckner closed 2 years ago
Hi @marcelbrueckner,
Thank you a lot for opening this topic since this should be documented properly. The strategy would be the following (here being the docs examples changed according to your needs):
1. First create NIC A and NIC B under LAN1 with different IPs. Create the ip_failover on LAN 1 with NIC A and failover IP of NIC A
2. Update NIC B IP to be failover IP
3. After this, you can create NIC C, NIC D and so on, with the ip being the failover ip, with no problems!
We will add this steps in our documentation. Thanks again for raising this issue and please let me know if it works for you!
P.S. We will also enable discussions on our repositories for this kind of topics.
Thanks @IuliaBlindu
I have adapted your example to my use-case and it works as you described. I've omitted the depends_on attribute from the IP failover group as Terraform seems clever enough to determine the dependencies on it's own.
But while this works, it's not really the path I would like to go with my infrastructure code. Because the code can't be used to re-create all infrastructure without changes.
Imagine a disaster recovery scenario, where I want to rebuild everything from scratch. I would use the latest commit of my infrastructure code to create everything, but having the same IP for all servers will initially fail as in my 2nd attempt, described in my initial post.
Of course I could wrap a Makefile
or similar around Terraform to do the IP replacement, but it's just an unnecessary overhead.
Passing a list instead of a single UUID to ionoscloud_ipfailover
's nicuuid
seem more logical to me. This might be done in conjunction of allowing the same IP being attached to different NICs from the very beginning (I now see that this is only possible if an IP failover group already exists - which isn't the case initially).
However, playing with it a little longer today I found a compromise I guess. Not very elegant code-wise (because WET), but this will allow me setting up everything even from scratch without changing code. I simply create the first server independently from others.
Hi @marcelbrueckner,
Yes, I totally understand. We will come with a more elegant solution, involving a list instead of a single UUID for the ionoscloud_ipfailover, as you mentioned. Since you have a workaround for the moment, how urgent is it for you?
The solution I came up with thanks to your example is sufficient for my use-case. Everything else I've mentioned is purely cosmetic.
So, not urgent at all.
Thank you again for opening this issue and for all the details provided! I will close the issue for now and will include an improvement on this side in our backlog .
Hi @marcelbrueckner , @IuliaBlindu that's an interesting discussion. I'll try it out next week if I find the time.
If I got it right, Iulia, you have to perform two times an apply, right?
I chose a different approach by not using count
but creating the two servers individually.
The order is then to create the first server with the failover-IP, create the ipfailover for that server and finally create the second server with the failover-IP.
(That's the way how it has to be done on the API).
However that needs an explicit depends_on = [ionoscloud_ipfailover.example]
for the second server.
Description
Not sure if a bug, but as discussions aren't enabled for this repo, I'm creating this issue. If what I want to achieve is generally not yet possible with the Terraform provider, consider this as a feature request.
I'm wrapping my head around IP failover configuration for my servers and can't find a way to get it working the way it does in DCD.
Expected behavior
Two servers that are part of the same public network should share a floating IP. For this, they should be member of the same IP failover group and the failover IP should appear on all servers as it appears when adding a failover group via UI.
Screenshots
![grafik](https://user-images.githubusercontent.com/3597890/158850195-d0175896-acb2-477a-9f6d-431f2f016b82.png) ![grafik](https://user-images.githubusercontent.com/3597890/158850274-69170624-8b3c-4c8a-89a3-7da8d83173fd.png) ![grafik](https://user-images.githubusercontent.com/3597890/158850324-206bfbff-c27b-4e00-bb4a-dcdab35fd883.png)Environment
Terraform version:
Tested with the following provider version:
OS:
Configuration Files
I've only set
IONOS_TOKEN
.How to Reproduce
Looking at the Data Center Designer UI, a failover group contains of a list of public NICs. The ionoscloud_ipfailover documentation however wants a string.
My first thought was to just add the failover twice via
count = 2
, using each serversnicuuid
.Maybe I need to add the floating IP to the servers upfront. Seems reasonable. Nothing easier than that I thought (Hint: not easy).
Next, I assigned the floating IP only to the first of my frontend servers. This lets Terraform complete successfully. But it doesn't look like I'm used to in the DCD WebUI.
Lastly, I created the failover IP group manually in the web UI and imported it into Terraform to see how it should look like.
When looking at the plan, you can see that both of my frontend servers have the floating IP assigned (something that's not possible using Terraform looking at my second attempt). Of course
terraform plan
also tries to remove that IP from the second server. When assigning the floating IP to both servers in my config, I can refresh my state without any changes.