hetznercloud / packer-plugin-hcloud

Packer plugin for Hetzner Cloud Builder
https://developer.hashicorp.com/packer/integrations/hetznercloud/hcloud
Mozilla Public License 2.0
22 stars 21 forks source link

feat: use existing IP for server create #144

Closed sjagoe closed 6 months ago

sjagoe commented 6 months ago

This PR adds the ability to specify an existing Primary IP in the Hetzner Cloud project to be used for a packer build.

For short-lived IP addresses, Hetzner sometimes sends abuse notifications to the wrong IP address user.

To avoid this, for most things I run in Hetzner Cloud, I use pre-allocated Primary IPs, set to not auto-delete when the server is removed, so that I have easier tracking of IP address allocation to respond appropriately to Hetzner abuse notifications.

jooola commented 6 months ago

Hey @sjagoe Thanks for the contribution!

Ignore the acceptance tests, they cannot succeed on forks.

Could you regenerate the docs? Using make generate

codecov[bot] commented 6 months ago

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (0bc73eb) 27.28% compared to head (4dc0cc8) 29.64%. Report is 2 commits behind head on main.

Files Patch % Lines
builder/hcloud/step_create_server.go 68.42% 8 Missing and 4 partials :warning:
builder/hcloud/config.hcl2spec.go 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #144 +/- ## ========================================== + Coverage 27.28% 29.64% +2.35% ========================================== Files 11 11 Lines 612 651 +39 ========================================== + Hits 167 193 +26 - Misses 424 433 +9 - Partials 21 25 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sjagoe commented 6 months ago

I have implemented IP search by name, and IPv6.

The plugin will still only use IPv4 to connect to the server, though. But there is still a case for assigning a static IPv6 to a server in any case (e.g. allowing the specific IPv6 address through a corporate firewall, for example).

sjagoe commented 6 months ago

I really appreciate that you are still sticking with us

Thanks, I appreciate your patience with me. This is the first Go I've written :smile: So building it up in small pieces was helpful to me anyway.

Edit: Lint is happy now :tada: thanks for the tips.