1
0

add vultr k8s

This commit is contained in:
michael 2024-04-18 13:28:39 +12:00
parent 8d049f3056
commit f68c6b227a
2 changed files with 51 additions and 0 deletions

20
terraform/vultr/k8s.tf Normal file
View File

@ -0,0 +1,20 @@
resource "vultr_kubernetes" "k8s" {
region = "ewr"
version = "v1.29.2+1"
label = "cluster00"
ha_controlplanes = false
enable_firewall = false
node_pools {
node_quantity = 1
plan = "vc2-2c-2gb"
label = "cluster00-worker-2c-2g"
auto_scaler = false
}
}
resource "local_sensitive_file" "kubeconfig" {
content_base64 = vultr_kubernetes.k8s.kube_config
filename = "~/.kube/vultr"
file_permission = "0600"
}

31
terraform/vultr/main.tf Normal file
View File

@ -0,0 +1,31 @@
terraform {
required_version = ">= 1.8.0"
required_providers {
vault = {
source = "hashicorp/vault"
version = ">= 4.2.0"
}
vultr = {
source = "vultr/vultr"
version = ">= 2.19.0"
}
}
backend "local" {
path = "/home/michael/Nextcloud/Backups/tfstate/vultr.tfstate"
}
}
provider "vault" {
# Export the vault token to the environment variable VAULT_TOKEN
address = "https://vault.balsillie.house"
}
data "vault_kv_secret" "vultr" {
path = "kv/vultr"
}
provider "vultr" {
api_key = data.vault_kv_secret.vultr.data.api_key
rate_limit = 100
retry_limit = 3
}