-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
85 lines (75 loc) · 1.93 KB
/
main.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "~> 1.42"
}
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.12"
}
random = {
source = "hashicorp/random"
version = "~> 3.5"
}
local = {
source = "hashicorp/local"
version = "~> 2.4"
}
remote = {
source = "tenstad/remote"
version = "~> 0.1"
}
kubectl = {
source = "alekc/kubectl"
version = ">= 2.0.0"
}
}
}
provider "hcloud" {
token = var.hcloud_api_token
}
provider "cloudflare" {
email = var.cloudflare_email
api_key = var.cloudflare_api_key
}
provider "helm" {
kubernetes {
host = local.cluster_endpoint
client_certificate = module.kubeconfig.client_certificate
client_key = module.kubeconfig.client_key
cluster_ca_certificate = module.kubeconfig.cluster_ca_certificate
}
}
provider "kubernetes" {
# config_path = "./kubeconfig.yaml"
host = local.cluster_endpoint
client_certificate = module.kubeconfig.client_certificate
client_key = module.kubeconfig.client_key
cluster_ca_certificate = module.kubeconfig.cluster_ca_certificate
}
provider "kubectl" {
# config_path = "./kubeconfig.yaml"
host = local.cluster_endpoint
client_certificate = module.kubeconfig.client_certificate
client_key = module.kubeconfig.client_key
cluster_ca_certificate = module.kubeconfig.cluster_ca_certificate
}
resource "hcloud_ssh_key" "default" {
name = "default"
public_key = file(var.ssh_public_key_file)
labels = {}
}
resource "random_string" "cluster_token_prefix" {
length = 6
upper = false
special = false
}
resource "random_string" "cluster_token_suffix" {
length = 16
upper = false
special = false
}
resource "random_bytes" "cluster_certificate_key" {
length = 32
}