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 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({ |
{} |
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({ |
{ |
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({ |
{ |
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. |