Merge pull request #34 from waammar/feature/add-placement-group

Add Hetzner placement group and link servers to it
This commit is contained in:
Karim Naufal 2022-01-30 01:09:38 +01:00 committed by GitHub
commit 4fb1e2fb85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 18 deletions

View File

@ -8,6 +8,7 @@ resource "hcloud_server" "agents" {
location = var.location location = var.location
ssh_keys = [hcloud_ssh_key.default.id] ssh_keys = [hcloud_ssh_key.default.id]
firewall_ids = [hcloud_firewall.k3s.id] firewall_ids = [hcloud_firewall.k3s.id]
placement_group_id = hcloud_placement_group.k3s_placement_group.id
labels = { labels = {

10
main.tf
View File

@ -174,3 +174,13 @@ resource "local_file" "traefik_config" {
file_permission = "0644" file_permission = "0644"
directory_permission = "0755" directory_permission = "0755"
} }
resource "hcloud_placement_group" "k3s_placement_group" {
name = "k3s-placement-group"
type = "spread"
labels = {
"provisioner" = "terraform",
"engine" = "k3s"
}
}

View File

@ -7,6 +7,7 @@ resource "hcloud_server" "first_control_plane" {
location = var.location location = var.location
ssh_keys = [hcloud_ssh_key.default.id] ssh_keys = [hcloud_ssh_key.default.id]
firewall_ids = [hcloud_firewall.k3s.id] firewall_ids = [hcloud_firewall.k3s.id]
placement_group_id = hcloud_placement_group.k3s_placement_group.id
labels = { labels = {
"provisioner" = "terraform", "provisioner" = "terraform",

View File

@ -8,6 +8,7 @@ resource "hcloud_server" "control_planes" {
location = var.location location = var.location
ssh_keys = [hcloud_ssh_key.default.id] ssh_keys = [hcloud_ssh_key.default.id]
firewall_ids = [hcloud_firewall.k3s.id] firewall_ids = [hcloud_firewall.k3s.id]
placement_group_id = hcloud_placement_group.k3s_placement_group.id
labels = { labels = {
"provisioner" = "terraform", "provisioner" = "terraform",