-
Notifications
You must be signed in to change notification settings - Fork 3
/
infra.tf
58 lines (50 loc) · 1.19 KB
/
infra.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
terraform {
required_version = ">= 0.15"
required_providers {
linode = {
source = "linode/linode"
}
}
}
provider "linode" {
token = var.linode_api_token
}
locals {
root_dir = "${abspath(path.root)}"
k8s_config_dir = "${local.root_dir}/.kube/"
k8s_config_file = "${local.root_dir}/.kube/kubeconfig.yaml"
}
variable "linode_api_token" {
description = "Your Linode API Personal Access Token. (required)"
sensitive = true
}
variable "k8s_node_type" {
default="g6-standard-2"
}
resource "linode_lke_cluster" "terraform_k8s" {
k8s_version="1.25"
label="try-knative"
region="us-east"
tags=["try-knative"]
pool {
type = var.k8s_node_type
count = 3
autoscaler {
min = 3
max = 8
}
}
lifecycle {
# uncomment when you need to make changes
# to the cluster pool
ignore_changes = [
pool,
]
create_before_destroy = true
}
}
resource "local_file" "k8s_config" {
content = "${nonsensitive(base64decode(linode_lke_cluster.terraform_k8s.kubeconfig))}"
filename = "${local.k8s_config_file}"
file_permission = "0600"
}