Terraform wrapper to make a Kubernetes cluster.
CC0-1.0 License
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"
}
}
var.k8s_version
is defined and not blank, the module will treat thevar.k8s_version
input mutually exclusive withvar.maintenance_policy
, they do render one another essentially inert.Set the DIGITALOCEAN_TOKEN
environment variable to your DigitalOcean API
token.
Name | Version |
---|---|
terraform | >= 1.3.0 |
digitalocean | ~> 2.0 |
Name | Version |
---|---|
digitalocean | 2.40.0 |
No modules.
Name | Type |
---|---|
digitalocean_kubernetes_cluster.this | resource |
digitalocean_kubernetes_node_pool.additional | resource |
digitalocean_kubernetes_versions.this | data source |
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. |