-
Notifications
You must be signed in to change notification settings - Fork 12
/
cloud_init.tf
48 lines (39 loc) · 1.03 KB
/
cloud_init.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# A simple dual-stack cluster with a single control plane node
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "~> 1.38"
}
}
}
variable "hetzner_token" {}
provider "hcloud" {
token = vars.hetzner_token
}
resource "hcloud_ssh_key" "key" {
name = "key"
public_key = file("~/.ssh/id_rsa.pub")
}
module "cluster" {
source = "tibordp/dualstack-k8s/hcloud"
name = "k8s"
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = vars.hetzner_token
location = "hel1"
server_type = "cpx31"
}
// After control plane is set up, additional workers can be joined
// just with user data (can be used for e.g. cluster autoscaler)
resource "hcloud_server" "instance" {
name = "additional-worker-node"
ssh_keys = [hcloud_ssh_key.key.id]
image = "ubuntu-20.04"
location = "hel1"
server_type = "cpx31"
user_data = module.cluster.join_user_data
}
output "kubeconfig" {
value = module.cluster.kubeconfig
sensitive = true
}