-
Notifications
You must be signed in to change notification settings - Fork 75
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
fix(server): migration to explicit primary IPs fails #597
Conversation
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
This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs. |
Closing as I have not managed to fix the bugs that came with my changes. This will be easier to implement after #752 |
A more robust implementation of func publicNetToTerraformPublicNet(publicNet hcloud.ServerPublicNet) map[string]interface{} {
tfPublicNet := make(map[string]interface{})
ipv4Enabled := !publicNet.IPv4.IsUnspecified()
tfPublicNet["ipv4_enabled"] = ipv4Enabled
if ipv4Enabled {
tfPublicNet["ipv4"] = publicNet.IPv4.ID
}
ipv6Enabled := !publicNet.IPv6.IsUnspecified()
tfPublicNet["ipv6_enabled"] = ipv6Enabled
if ipv6Enabled {
tfPublicNet["ipv6"] = publicNet.IPv6.ID
}
return tfPublicNet
} |
Adding
This can only be solved by the plugin framework, which gives us access to the precise configuration that the user specified: https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource#UpdateRequest |
Reopening as the issue is still relevant, we are just being blocked by the migration to the plugin framework. |
Nevermind, I thought it was an issue, not a PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #597 +/- ##
=======================================
Coverage ? 30.56%
=======================================
Files ? 66
Lines ? 9956
Branches ? 0
=======================================
Hits ? 3043
Misses ? 6873
Partials ? 40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
When migrating a server from the previously used implicit primary IPs to using the
hcloud_primary_ip
resources and specifying those in thehcloud_server.public_net
argument failed, because the state for thepublic_net
was not correctly populated. This caused the servers to require an unnecessary re-attach of the primary ips.Fixes #577