devops/infra/modules/cluster/hcloud/main.tf

30 lines
651 B
HCL

resource "hcloud_server" "node" {
name = "${local.cluster_name}-${count.index + 1}"
image = var.node_image
server_type = var.instance_type
location = var.hcloud_location
ssh_keys = [var.ssh_key_id]
count = var.node_count
network {
network_id = var.hcloud_network_id
}
public_net {
ipv4_enabled = false
ipv6_enabled = false
}
user_data = templatefile(
format("%s/files/userdata_node.template", path.module),
{
username = local.node_username
register_command = var.cluster_registration_command
}
)
lifecycle {
ignore_changes = [ssh_keys, network]
}
}