Add hcloud placement group

This commit is contained in:
Tobias Reisinger 2024-10-13 19:01:00 +02:00
parent 3354ce607d
commit e14ef048cc
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
2 changed files with 6 additions and 2 deletions

View file

@ -134,8 +134,6 @@ provider "postgresql" {
module "services" {
source = "./modules/services"
depends_on = [ module.infrastructure ]
authentik_url = var.authentik_url
services = var.services

View file

@ -12,6 +12,11 @@ data "template_file" "cloud_init" {
}
}
resource "hcloud_placement_group" "default" {
name = "serguzim.net"
type = "spread"
}
resource "hcloud_primary_ip" "node_ipv4_addresses" {
for_each = local.hetzner_hosts
name = "primary_ipv4_${each.value.hostname}"
@ -39,6 +44,7 @@ resource "hcloud_server" "nodes" {
server_type = each.value.server_type
ssh_keys = [hcloud_ssh_key.default.id]
user_data = data.template_file.cloud_init.rendered
placement_group_id = hcloud_placement_group.default.id
public_net {
ipv4 = hcloud_primary_ip.node_ipv4_addresses[each.key].id
ipv6 = hcloud_primary_ip.node_ipv6_addresses[each.key].id