Skip to content

feat: add possibility do select IP used to connect to server#387

Open
Bartosz-lab wants to merge 1 commit into
hetznercloud:mainfrom
Bartosz-lab:main
Open

feat: add possibility do select IP used to connect to server#387
Bartosz-lab wants to merge 1 commit into
hetznercloud:mainfrom
Bartosz-lab:main

Conversation

@Bartosz-lab

Copy link
Copy Markdown

Summary

Adds a new ssh_interface builder option to control which server IP address Packer uses for the communicator connection.

Previously, the builder always selected the first available address in this order:

  1. public IPv4
  2. public IPv6
  3. private IPv4

This could be problematic in environments where public IPv4 is present on the server but not reachable from the machine running Packer. With this change, users can explicitly select the interface used for SSH:

ssh_interface = "public_ipv6"

Supported values are:

  • public_ipv4
  • public_ipv6
  • private_ipv4

When ssh_interface is unset, the existing default behavior is preserved.

Changes

  • Added ssh_interface to the hcloud builder config.
  • Added validation for supported ssh_interface values.
  • Updated server IP selection logic to honor the configured interface.
  • Kept the existing first-available-IP behavior as the default.
  • Updated HCL2 config spec.
  • Documented the new option.
  • Added tests for config validation and IP selection.

@Bartosz-lab
Bartosz-lab requested a review from a team as a code owner July 21, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant