33 lines
809 B
Terraform
33 lines
809 B
Terraform
|
resource "hcloud_server" "k8s-single" {
|
||
|
name = "k8s-single"
|
||
|
image = var.os_type
|
||
|
server_type = var.server_type
|
||
|
location = var.location
|
||
|
labels = {
|
||
|
type = "single"
|
||
|
}
|
||
|
ssh_keys = [hcloud_ssh_key.default.id]
|
||
|
user_data = templatefile(
|
||
|
"user-data.yaml.tpl",
|
||
|
{
|
||
|
ssh_pubkey = file("../ssh-terraform-hetzner.pub")
|
||
|
containerd_version = var.containerd_version
|
||
|
docker_version = var.docker_version
|
||
|
}
|
||
|
)
|
||
|
firewall_ids = [hcloud_firewall.k8s-single.id]
|
||
|
|
||
|
connection {
|
||
|
type = "ssh"
|
||
|
user = "root"
|
||
|
host = self.ipv6_address # or ipv4_address if your ISP sucks
|
||
|
private_key = file("../ssh-terraform-hetzner")
|
||
|
}
|
||
|
|
||
|
provisioner "remote-exec" {
|
||
|
inline = [
|
||
|
"cloud-init status --wait"
|
||
|
]
|
||
|
}
|
||
|
}
|