Skip to content

Latest commit

 

History

History

doks

Workspace doks

This directory contains DigitalOcean resources for a Kubernetes deployment.

Table of Contents

Requirements

  • Terraform CLI 1.7.4 or newer
  • a DigitalOcean account

Usage

This repository uses a standard Terraform workflow (init, plan, apply).

For more information, including detailed usage guidelines, see the Terraform documentation.

Inputs

Name Description Type Required
do_token This is the DO API token. string yes
do_region The slug identifier for the region where the resources will be created. string no
tfe_workspaces_prefix Prefix for TFE Workspaces. string no

Outputs

Name Description
cluster_id DOKS Cluster ID.
cluster_name DOKS Cluster Name.
cluster_region DOKS Cluster Region.
command_add_to_kubeconfig Command to add Cluster to .kubeconfig.
console_url DigitalOcean Console URL.
workspace_url this variable is used for testing purposes and has no bearing on the demo see https://developer.hashicorp.com/terraform/language/values/outputs

Downstream Consumption

In Terraform

The Kubernetes Cluster can be consumed via the digitalocean_kubernetes_cluster data source:

# see https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs/data-sources/kubernetes_cluster
data "digitalocean_kubernetes_cluster" "cluster" {
  name = "multi-cloud-k8s"
}

The above example uses the default values for the name property. This may need to be changed for your situation.

In kubectl

To add the cluster configuration to your kubectl configuration, use the following Terraform Output:

terraform output -raw command_add_to_kubeconfig