ruanbekker / terraform-kubernetes-vultr-module

Terraform Module to deploy a VKE Cluster on Vultr.
1 stars 1 forks source link
kubernetes terraform vultr vultr-vke

terraform-kubernetes-vultr-module

Terraform Module to deploy a VKE Cluster on Vultr.

Requirements

Name Version
vultr 2.21.0

Providers

Name Version
vultr 2.21.0

Modules

No modules.

Resources

Name Type
vultr_kubernetes.this resource
vultr_plan.selected data source
vultr_region.city data source

Inputs

Name Description Type Default Required
cluster_name The kubernetes cluster name. string "test" no
cluster_version The kubernetes version. string "v1.29.4+1" no
monthly_cost The monthly costage. string "10" no
ram The amount of ram in megabytes. string "2048" no
region_city The city name of the region string "Amsterdam" no
vcpu_count The amount of vcpu cores. string "1" no

Outputs

Name Description
client_certificate n/a
client_key n/a
cluster_ca_certificate n/a
endpoint The kubernetes api endpoint.
kube_config The kubeconfig in yaml format.

Example

You can see a full example in ./example/, and authentication needs to be provided using a api key, which can be seen at ./example/providers.tf.

module "kubernetes" {
  source  = "git::https://github.com/ruanbekker/terraform-kubernetes-vultr-module.git?ref=stable"

  cluster_name    = "test-cluster"
  cluster_version = "v1.29.4+1"
}

output "kubeconfig" {
  value     = module.kubernetes.kube_config
  sensitive = true
}

Deploy:

export TF_VAR_vultr_api_key="<vultr-api-key>"
terraform init
terraform apply -auto-approve

Set kubeconfig:

export KUBECONFIG=/tmp/vultr.kubeconfig
terraform output -raw kubeconfig | base64 -d > $KUBECONFIG

Access the cluster:

kubectl get nodes

Module Documentation

The documentation was generated with:

docker run --rm --volume "$(pwd):/terraform-docs" -u $(id -u) quay.io/terraform-docs/terraform-docs:0.18.0 markdown /terraform-docs