Builds a DigitalOcean Kubernetes cluster in a way that makes more sense to
me, and is more easily wrapped in a manner to keep the Terraform code DRY.
module "cluster" {
source = "santiagon610/k8s-cluster/digitalocean"
version = "~> 2"
cluster_name = "my-awesome-cluster"
region = "nyc1"
vpc_uuid = data.digitalocean_vpc.production.id
cluster_tags = ["production"]
initial_node_pool = {
name = "primary"
size = "s-4vcpu-8gb"
min_nodes = 1
max_nodes = 4
auto_scale = true
labels = {
pizza = "pepperoni"
environment = "prod"
}
}
maintenance_policy = {
start_time = "22:00"
day = "monday"
}
}
- If
var.k8s_version is defined and not blank, the module will treat the
version of Kubernetes as pinned and will disable automatic upgrades, and
as a result will remove the maintenance policy. Although this does not
make make the var.k8s_version input mutually exclusive with
var.maintenance_policy, they do render one another essentially inert.
Set the DIGITALOCEAN_TOKEN environment variable to your DigitalOcean API
token.
CC0 1.0 Universal
No modules.
| Name |
Description |
Type |
Default |
Required |
| additional_node_pools |
Configuration for additional node pools |
map(object({ min_nodes = number max_nodes = number size = string auto_scale = bool labels = map(string) })) |
{} |
no |
| cluster_name |
Display name of Kubernetes cluster |
string |
n/a |
yes |
| cluster_tags |
Tags to apply to Kubernetes cluster within DigitalOcean console |
list(string) |
[] |
no |
| do_registry_integration |
Enable integration with DigitalOcean Container Registry |
bool |
true |
no |
| initial_node_pool |
Configuration for initial node pool |
object({ name = string min_nodes = number max_nodes = number size = string auto_scale = bool labels = map(string) }) |
{ "auto_scale": true, "labels": { "droplet-size": "s-4vcpu-8gb", "managed-by": "terraform", "purpose": "default" }, "max_nodes": 2, "min_nodes": 1, "name": "initial", "size": "s-4vcpu-8gb" } |
no |
| k8s_version |
Version of k8s control plane to use. If blank, uses data.digitalocean_kubernetes_versions.this.latest_version |
string |
"" |
no |
| maintenance_policy |
Maintenance policy for Kubernetes control plane. Ignored if var.k8s_version is defined. |
object({ start_time = string day = string }) |
{ "day": "sunday", "start_time": "04:00" } |
no |
| region |
DigitalOcean region in which to build Kubernetes cluster |
string |
"nyc1" |
no |
| vpc_uuid |
UUID of the VPC network in which to build Kubernetes cluster |
string |
n/a |
yes |
| Name |
Description |
| kubeconfig |
Kubernetes configuration for the cluster, provided in HCL and YAML. |