forked from tibordp/terraform-hcloud-dualstack-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud_init.tf
49 lines (39 loc) · 1.04 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
49
# A simple dual-stack cluster with a single master node
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.26.0"
}
}
}
variable "hetzner_token" {}
provider "hcloud" {
token = vars.hetzner_token
}
resource "hcloud_ssh_key" "key" {
name = "key"
public_key = file("~/.ssh/id_rsa.pub")
}
module "k8s" {
source = "tibordp/dualstack-k8s/hcloud"
name = "k8s"
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = vars.hetzner_token
location = "hel1"
master_server_type = "cx31"
worker_server_type = "cx31"
}
// 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 = "cx31"
user_data = module.k8s.join_user_data
}
output "simple_kubeconfig" {
value = module.k8s.kubeconfig
}