1
0
Fork 0
This repository has been archived on 2025-08-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mareshq-cthulhunetes-infras.../modules/node-pool/v1/main.tf

45 lines
1 KiB
HCL

resource "random_string" "suffix" {
length = 4
special = false
upper = false
}
resource "hcloud_network_subnet" "pool" {
network_id = var.network_id
type = "cloud"
network_zone = "eu-central"
ip_range = var.subnet_cidr
}
resource "hcloud_server" "pool" {
count = var.size
name = "pool-${random_string.suffix.result}-${count.index + 1}"
image = var.image
server_type = var.server_type
location = var.location
backups = false
shutdown_before_deletion = true
placement_group_id = var.placement_group_id
ssh_keys = var.ssh_key_ids
labels = {
"k8s.node.role" = "worker"
"k8s.node.name" = "pool-${random_string.suffix.result}-${count.index}"
"k8s.cluster.name" = var.cluster_name
"k8s.node.pool" = random_string.suffix.result
}
public_net {
ipv4_enabled = true
ipv6_enabled = false
}
network {
network_id = var.network_id
ip = cidrhost(hcloud_network_subnet.pool.ip_range, count.index + 1)
}
}