36 lines
787 B
Terraform
Raw Normal View History

resource "hcloud_server" "private_node" {
count = var.server_count
name = "web${count.index + 1}"
image = var.server_image
server_type = var.server_type
location = var.location
labels = {
app = "web"
}
public_net {
ipv4_enabled = false
ipv6_enabled = false
}
network {
network_id = hcloud_network.main.id
ip = cidrhost(hcloud_network_subnet.main.ip_range, count.index + 2)
}
depends_on = [
hcloud_network_subnet.main
]
}
resource "hcloud_network" "main" {
name = "main"
ip_range = var.network_ip_range
}
resource "hcloud_network_subnet" "main" {
network_id = hcloud_network.main.id
type = "cloud"
network_zone = var.network_zone
ip_range = var.server_subnetwork_ip_range
}