-
Notifications
You must be signed in to change notification settings - Fork 77
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
[Bug]: importing primary IPs generally buggy #577
Comments
And one minor thing I forgot - documentation claims that "assignee_type" for hcloud_primary_ip was optional, but in practice I got "Missing required argument" error so I had to add it (hence it's in the example). |
Also i wanted to add one more problem to this, in my opinion related to the public_ip case. Replay like this:
# module.vm.hcloud_server.servers["centos-xxxxx"] will be updated in-place
~ resource "hcloud_server" "servers" {
+ allow_deprecated_images = false
id = "123456"
+ ignore_remote_firewall_ids = false
+ keep_disk = false
~ labels = {
+ "source" = "terraform"
}
name = "centos-xxxxx"
# (13 unchanged attributes hidden)
+ public_net {
+ ipv4 = 123456
+ ipv4_enabled = true
+ ipv6 = 654321
+ ipv6_enabled = true
}
# (1 unchanged block hidden)
}
"public_net" : []
More recently there was a need to import 200+ servers. And this was one of the most unpleasant nuances. |
When migrating a server from the previously used implicit primary IPs to using the `hcloud_primary_ip` resources and specifying those in the `hcloud_server.public_net` argument failed, because the state for the `public_net` was not correctly populated. This caused the servers to require an unnecessary re-attach of the primary ips. Fixes #577
There's a severe bug also when importing primary IP and then assigning it to an instance like
This resulted in the ipv4 primary IP being deleted and the terraform failing with the following.
Where the plan only showed an update, not a destructive operation
PLEASE add a warning to the docs to enable the delete protection when importing so that others don't have a bad day. |
Hey @daxroc, sorry to hear that you encountered a critical bug, could you post more detailed reproduction steps & your terraform code to help us fix the bug? |
This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs. |
Sadly, like multiple other open issues, we will only be able to solve this by/after migrating to the plugin framework. See #752 for more information about the migration. |
What happened?
Since the new flexible netowrking was introduced, I wanted to import primary IPs that already existed for my server, and also reflect that change for "hcloud_server" that already had these IPs assigned. Couple of unexpected things happened:
What did you expect to happen?
I expected the apply after the import to succeed, and effectively only change a bunch of parameters to the primary IPs, and do nothing for the hcloud_server.
Please provide a minimal working example
I think what would recreate my situation would be first to create this:
Then once that is applied and succesfully created, adding this:
and this block to hcloud_server:
The import:
And then terraform apply causes things I'm describing (so first apply returns invalid IP, second apply complains about the floating IP and turns off the server, turning server back on manually and then doing apply works fine... except setting auto_delete doesn't work but that seems to be issue #565 and I'm assuming the fix wasn't released yet.
The text was updated successfully, but these errors were encountered: