/terraform-digitalocean-doks

Terraform module for Digital Ocean Kubernetes (DOKS)

Primary LanguageHCL

terraform-digitalocean-doks

Terraform Registry

Terraform module which configure a Kubernetes cluster (DOKS) on Digital Ocean

Versions

Use Terraform 0.13+ and Terraform Provider Digital Ocean 1.22.0+

These types of resources are supported:

Usage

module "kubernetes" {
  source  = "nlamirault/doks/digitalocean"
  version = "x.y.z"

  cluster_name       = var.cluster_name
  auto_upgrade       = var.auto_upgrade
  region             = var.region
  kubernetes_version = var.kubernetes_version
  tags               = var.tags

  size        = var.size
  auto_scale  = var.auto_scale
  min_nodes   = var.min_nodes
  max_nodes   = var.max_nodes
  node_count  = var.node_count
  node_tags   = var.node_tags
  node_labels = var.node_labels

  node_pools = var.node_pools
}

With variables :

cluster_name = "portefaix-sandbox-do-k8s"

region = "fra1"

kubernetes_version = "1.18.10"
auto_upgrade = true
size = "s-1vcpu-2gb"

auto_scale = true
min_nodes = 1
max_nodes = 2
node_count = 1

node_labels = {
  env      = "prod"
  service  = "kubernetes"
  made-by  = "terraform"
}

node_tags = ["kubernetes", "nodes"]

node_pools = {}
#node_pools = {
#  "ops" = {
#    auto_scale = true
#    min_nodes = 1
#    max_nodes = 3
#    node_count = 1
#    size = "s-1vcpu-2gb"
#    node_labels = {
#      env      = "prod"
#      service  = "kubernetes"
#      made-by  = "terraform"
#  }
#    node_tags = ["kubernetes", "nodes"]
#  }
#}

This module creates :

  • a Kubernetes cluster
  • node pool(s)

Documentation

Providers

Name Version
digitalocean >= 1.22.0

Inputs

Name Description Type Default Required
auto_scale Enable cluster autoscaling bool n/a yes
auto_upgrade Whether the cluster will be automatically upgraded bool n/a yes
cluster_name Cluster name string n/a yes
kubernetes_version The EKS Kubernetes version string n/a yes
max_nodes Autoscaling maximum node capacity string 5 no
min_nodes Autoscaling Minimum node capacity string 1 no
node_count The number of Droplet instances in the node pool. number n/a yes
node_labels List of Kubernetes labels to apply to the nodes map
{
"service": "kubernetes"
}
no
node_pools Addons node pools
map(object({
size = string
node_count = number
auto_scale = bool
min_nodes = number
max_nodes = number
node_tags = list(string)
node_labels = map(string)
}))
{} no
node_tags The list of instance tags applied to all nodes. list
[
"kubernetes"
]
no
region The location of the cluster string n/a yes
size The slug identifier for the type of Droplet to be used as workers in the node pool. string n/a yes
tags The list of instance tags applied to the cluster. list
[
"kubernetes"
]
no

Outputs

No output.