Base configuration for settingup vke

This commit is contained in:
shockrah 2024-01-16 16:05:38 -08:00
parent 69d75cdb2d
commit 8a66a04337
5 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,24 @@
plan=out.plan
SHELL := /bin/bash
$(plan): *.tf
source ./secrets.env && terraform plan -input=false -out $(plan)
push: build
source ./secrets.env && terraform apply $(plan)
refresh:
source ./secrets.env && terraform apply -refresh-only
test:
terraform validate
rip:
source ./secrets.env && terraform destroy
clean:
rm -f $(plan)
.PHONY: test build clean push rip

View File

@ -0,0 +1,34 @@
terraform {
required_version = ">= 0.13"
backend s3 {
bucket = "project-athens"
key = "infra/vke/state/build.tfstate"
region = "us-west-1"
encrypt = true
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
vultr = {
source = "vultr/vultr"
version = "2.19.0"
}
}
}
provider vultr {
api_key = var.vultr_api_key
rate_limit = 100
retry_limit = 3
}
provider aws {
access_key = var.aws_key
secret_key = var.aws_secret
region = var.aws_region
max_retries = 1
}

View File

@ -0,0 +1,13 @@
resource vultr_kubernetes athens {
region = var.cluster.region
version = var.cluster.version
label = var.cluster.label
node_pools {
# how many pools do we want
node_quantity = 1
plan = var.cluster.pool.plan
label = var.cluster.pool.label
min_nodes = var.cluster.pool.min
max_nodes = var.cluster.pool.max
}
}

View File

@ -0,0 +1,5 @@
# Kubernetes Cluster On Vultr

View File

@ -0,0 +1,35 @@
# API Keys required to reach AWS/Vultr
variable vultr_api_key {
type = string
sensitive = true
}
variable aws_key {
type = string
sensitive = true
}
variable aws_secret {
type = string
sensitive = true
}
variable aws_region {
type = string
sensitive = true
}
# Cluster configuration
variable cluster {
type = object({
region = string
label = string
version = string
pool = object({
plan = string
autoscale = bool
min = number
max = number
})
})
}