Add hcloud placement group
This commit is contained in:
parent
3354ce607d
commit
e14ef048cc
2 changed files with 6 additions and 2 deletions
2
main.tf
2
main.tf
|
@ -134,8 +134,6 @@ provider "postgresql" {
|
||||||
module "services" {
|
module "services" {
|
||||||
source = "./modules/services"
|
source = "./modules/services"
|
||||||
|
|
||||||
depends_on = [ module.infrastructure ]
|
|
||||||
|
|
||||||
authentik_url = var.authentik_url
|
authentik_url = var.authentik_url
|
||||||
|
|
||||||
services = var.services
|
services = var.services
|
||||||
|
|
|
@ -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" {
|
resource "hcloud_primary_ip" "node_ipv4_addresses" {
|
||||||
for_each = local.hetzner_hosts
|
for_each = local.hetzner_hosts
|
||||||
name = "primary_ipv4_${each.value.hostname}"
|
name = "primary_ipv4_${each.value.hostname}"
|
||||||
|
@ -39,6 +44,7 @@ resource "hcloud_server" "nodes" {
|
||||||
server_type = each.value.server_type
|
server_type = each.value.server_type
|
||||||
ssh_keys = [hcloud_ssh_key.default.id]
|
ssh_keys = [hcloud_ssh_key.default.id]
|
||||||
user_data = data.template_file.cloud_init.rendered
|
user_data = data.template_file.cloud_init.rendered
|
||||||
|
placement_group_id = hcloud_placement_group.default.id
|
||||||
public_net {
|
public_net {
|
||||||
ipv4 = hcloud_primary_ip.node_ipv4_addresses[each.key].id
|
ipv4 = hcloud_primary_ip.node_ipv4_addresses[each.key].id
|
||||||
ipv6 = hcloud_primary_ip.node_ipv6_addresses[each.key].id
|
ipv6 = hcloud_primary_ip.node_ipv6_addresses[each.key].id
|
||||||
|
|
Loading…
Reference in a new issue