Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/host/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ resource "hcloud_server" "server" {
provisioner "local-exec" {
command = <<-EOT
timeout 600 bash <<EOF
until ssh ${local.ssh_args} -i /tmp/${random_string.identity_file.id} ${local.ssh_proxy_jump} -o ConnectTimeout=2 -p ${var.ssh_port} root@${coalesce(self.ipv4_address, self.ipv6_address, try(one(self.network).ip, null))} true 2> /dev/null
until ssh ${local.ssh_args} -i /tmp/${random_string.identity_file.id} ${local.ssh_proxy_jump} -o ConnectTimeout=10 -p ${var.ssh_port} root@${coalesce(self.ipv4_address, self.ipv6_address, try(one(self.network).ip, null))} true 2> /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ConnectTimeout value is hardcoded to 10. While increasing the timeout from 2s is a good improvement, hardcoding the new value reduces the module's flexibility. It would be better to expose this as a variable (e.g., ssh_connect_timeout with a default of 10) so that users of the module can adjust it based on their specific network conditions and server startup times.

do
echo "Waiting for MicroOS to become available..."
sleep 3
Expand Down
2 changes: 1 addition & 1 deletion modules/host/templates/cloudinit.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ${cloudinit_runcmd_common}
# Configure default routes based on public ip availability
%{if private_network_only~}
# Private-only setup: eth0 is the private interface
- [ip, route, add, default, via, '${network_gw_ipv4}', dev, 'eth0', metric, '100']
- [ip, route, add, default, via, '${network_gw_ipv4}', dev, 'enp7s0', metric, '100']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Hardcoding the network interface name to enp7s0 is brittle. Network interface names can vary across different operating systems or even kernel versions (e.g., eth0 vs. predictable network interface names like enp7s0). This change might fix the issue for one environment but break it for others. A more robust solution would be to make the interface name configurable via a template variable. Additionally, the comment on the preceding line (37) is now outdated and should be updated to avoid confusion.

%{else~}
# Standard setup: eth0 is public, configure both IPv4 and IPv6
- [ip, route, add, default, via, '172.31.1.1', dev, 'eth0', metric, '100']
Expand Down