-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathmain.tf
More file actions
51 lines (44 loc) · 1.47 KB
/
main.tf
File metadata and controls
51 lines (44 loc) · 1.47 KB
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
terraform {
backend "s3" {
endpoint = "<KUBEFIRST_STATE_STORE_BUCKET_HOSTNAME>"
bucket = "<KUBEFIRST_STATE_STORE_BUCKET>"
key = "terraform/vultr/terraform.tfstate"
// Don't change this.
// https://www.vultr.com/docs/how-to-store-terraform-state-in-vultr-object-storage/
region = "us-east-1"
skip_credentials_validation = true
skip_metadata_api_check = true
skip_region_validation = true
force_path_style = true
}
required_providers {
vultr = {
source = "vultr/vultr"
}
}
}
provider "vultr" {}
locals {
cluster_name = "<CLUSTER_NAME>"
pool_name = "${local.cluster_name}-node-pool"
pool_instance_type = "<NODE_TYPE>"
kube_config_filename = "../../../kubeconfig"
kubernetes_version = "v1.28.3+2"
}
resource "vultr_kubernetes" "kubefirst" {
region = "<CLOUD_REGION>"
label = local.cluster_name
version = local.kubernetes_version
node_pools {
plan = local.pool_instance_type
label = local.pool_name
auto_scaler = true
node_quantity = tonumber("<NODE_COUNT>") # tonumber() is used for a string token value
min_nodes = tonumber("<NODE_COUNT>") # tonumber() is used for a string token value
max_nodes = tonumber("<NODE_COUNT>") # tonumber() is used for a string token value
}
}
resource "local_file" "kubeconfig" {
content = base64decode(vultr_kubernetes.kubefirst.kube_config)
filename = local.kube_config_filename
}