Base configuration for settingup vke
This commit is contained in:
parent
69d75cdb2d
commit
8a66a04337
24
infra/vultr-kubernetes/Makefile
Normal file
24
infra/vultr-kubernetes/Makefile
Normal 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
|
34
infra/vultr-kubernetes/backend.tf
Normal file
34
infra/vultr-kubernetes/backend.tf
Normal 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
|
||||
}
|
||||
|
||||
|
13
infra/vultr-kubernetes/cluster.tf
Normal file
13
infra/vultr-kubernetes/cluster.tf
Normal 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
|
||||
}
|
||||
}
|
5
infra/vultr-kubernetes/readme.md
Normal file
5
infra/vultr-kubernetes/readme.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Kubernetes Cluster On Vultr
|
||||
|
||||
|
||||
|
||||
|
35
infra/vultr-kubernetes/variables.tf
Normal file
35
infra/vultr-kubernetes/variables.tf
Normal 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
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user