From e14ef048ccf5e9f23849846d7137e8e4fae6705e Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Sun, 13 Oct 2024 19:01:00 +0200 Subject: [PATCH] Add hcloud placement group --- main.tf | 2 -- modules/infrastructure/hcloud.tf | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index f285ec7..82908b3 100644 --- a/main.tf +++ b/main.tf @@ -134,8 +134,6 @@ provider "postgresql" { module "services" { source = "./modules/services" - depends_on = [ module.infrastructure ] - authentik_url = var.authentik_url services = var.services diff --git a/modules/infrastructure/hcloud.tf b/modules/infrastructure/hcloud.tf index 604f473..adcbb88 100644 --- a/modules/infrastructure/hcloud.tf +++ b/modules/infrastructure/hcloud.tf @@ -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