Setup a Cluster

Cluster on DigitalOcean

In this section we show you how to use the digitalocean terraform module to setup your own infrastructure on digital ocean provider.

Setup Project

You can use our digitalocean template to create a repository. Click on the Use this template link on the repo.

use module template

Name the module and simply clone the repository down.

Let’s begin by cloning our repository we created using the template.

git clone [email protected]:<your-organization>/<your-repo>.git

Cluster Bootstrap

Once you’ve cloned down the repository simply replace the cluster_name with the desired name for your cluster. You can also update the node_size and the size parameter in the cluster_topology based on the value you wish to use from list of slugs provided by digitalocean.

Once you’ve updated the values create a .auto.tfvars and add your tokens.

do_token = <your digital ocean api token>
instellar_auth_token = <your instellar auth token>

You can get the instellar_auth_token by signing up and heading over to the Credentials page on instellar.


This section assumes you already know how to generate the ssh-key. If you don’t know how to do this I recommend this post. To add the ssh-key to digital ocean. Head to the Settings area.


Find the Security tab.

security tab

Click on the Add SSH Key button.

add ssh key

Copy your public key from the command line and paste it in the SSH Key content area. Give it a name and click Add SSH Key.

new ssh key modal

Once add the ssh key you can copy the finger print and use it in your

API Token

Let’s look at how we can retrieve the API token to be used with digital ocean on terraform cloud.

Head over to the API section on the main navigation.

api nav

You’ll see the personal access token area. Click on the Generate New Token button.

personal access tokens

Give your token a name. I suggest naming it with your cluster name and prefix it with terraform. So you know this token is being utilized by terraform.

For expiration you can use 90 days or longer. Do remember to change this token in terraform cloud.

Once you’ve entered the name and chosen the expiration time for the token click Generate Token.

new personal access token

You’ll get to see the token once. Copy it and either use it in your .auto.tfvars or your terraform cloud.

Running Locally via CLI

Sensitive Token

The hcloud_token variable should not be checked into your code repository.

The do_token variable should not be checked into your code repository. If you’re planning on running terraform locally, you can create a .auto.tfvars file and add the variable there. This file will only exist locally on your machine and will not be checked into your github repo.

do_token = "<your-do-token>"

If you use the template above the .auto.tfvars is automatically ignored.

Once all the configuration files are in place simply run:

terraform init
terraform plan
terraform apply

If you have further suggestions on how we can make this better please don't hesitate to open an issue. Or reach out to us via one of our support channels. If you need a quick support and would like to chat you can join our slack group.