Merge pull request #34 from waammar/feature/add-placement-group
Add Hetzner placement group and link servers to it
This commit is contained in:
commit
4fb1e2fb85
13
agents.tf
13
agents.tf
@ -2,12 +2,13 @@ resource "hcloud_server" "agents" {
|
|||||||
count = var.agents_num
|
count = var.agents_num
|
||||||
name = "k3s-agent-${count.index}"
|
name = "k3s-agent-${count.index}"
|
||||||
|
|
||||||
image = data.hcloud_image.linux.name
|
image = data.hcloud_image.linux.name
|
||||||
rescue = "linux64"
|
rescue = "linux64"
|
||||||
server_type = var.agent_server_type
|
server_type = var.agent_server_type
|
||||||
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
10
main.tf
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
13
master.tf
13
master.tf
@ -1,12 +1,13 @@
|
|||||||
resource "hcloud_server" "first_control_plane" {
|
resource "hcloud_server" "first_control_plane" {
|
||||||
name = "k3s-control-plane-0"
|
name = "k3s-control-plane-0"
|
||||||
|
|
||||||
image = data.hcloud_image.linux.name
|
image = data.hcloud_image.linux.name
|
||||||
rescue = "linux64"
|
rescue = "linux64"
|
||||||
server_type = var.control_plane_server_type
|
server_type = var.control_plane_server_type
|
||||||
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",
|
||||||
|
13
servers.tf
13
servers.tf
@ -2,12 +2,13 @@ resource "hcloud_server" "control_planes" {
|
|||||||
count = var.servers_num - 1
|
count = var.servers_num - 1
|
||||||
name = "k3s-control-plane-${count.index + 1}"
|
name = "k3s-control-plane-${count.index + 1}"
|
||||||
|
|
||||||
image = data.hcloud_image.linux.name
|
image = data.hcloud_image.linux.name
|
||||||
rescue = "linux64"
|
rescue = "linux64"
|
||||||
server_type = var.control_plane_server_type
|
server_type = var.control_plane_server_type
|
||||||
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",
|
||||||
|
Loading…
Reference in New Issue
Block a user