Back to Blog

Up and Running on Kaleido with Terraform

SaaS platforms’ primary motivations tend to focus on removing complexity and providing simplicity for clients as they drive their missions’ forward. Kaleido is no exception. We realized during our scaling tests that teams managing massive networks would require a tool to maintain visibility, understanding, and speed that our UI nor API could easily deliver by themselves. HashiCorp’s Terraform delivers a beautiful and declarative infrastructure as code tool that the Kaleido team benefits heavily from when managing our own environments on a day to day basis, and now your team can leverage for their own Kaleido deployments. Now, let us get you up and running with the Kaleido Terraform provider.

First, install Terraform. If using Terraform for the first time get started with their “Getting Started” tutorial to learn the art of the possible. I would encourage reading the entire tutorial, but today just the “Install Terraform” section will do.

Second, download and install the Kaleido Terraform Provider from the kaleido-io/terraform-provider-kaleido releases page. Place the downloaded binary into your ~/.terraform.d/plugins directory for Linux and Mac or terraform.d/plugins underneath the Windows “Application Data” directory. (Read more here)

Deploying My First Environment

Provided in the “terraform-provider-kaleido” repository is the which we will use as an example. Place the contents of in a convenient directory and then run “terraform init” which will make the Kaleido Terraform provider available within the directory.

Running “terraform plan” will ask you to insert a value for var.kaleido_api_key which the Terraform Provider will use to make API calls against Kaleido on your behalf. Once you have created a key via the Kaleido’s “API” page (see Kaleido’s API 101 Documentation) and inserted the key into the Terraform prompt it will tell you that it would create 1 App Credential, 1 Consortium, 1 Environment, 1 Membership, and 1 Node. If you want to actually enact these changes a simple “terraform apply” will deploy them. Amazing!

Tweaking the System

Perhaps instead of deploying a Quorum RAFT based environment, you would prefer to deploy a Quorum IBFT based environment. Open with your favorite text editor. Find the variable “quorum_consensus”:

You will see it contains an array with the values “raft” and “ibft”. Scroll a little farther down to find the “kaleido_environment” resource “myEnv”. Take a closer look at “myEnv”’s “consensus_type”. “consensus_type” contains a Terraform interpolation:

Did you notice “${element(var.quorum_consensus, 0)}”? This uses the “element” function to select the 0th element from the var.quorum_consensus list which just so happens to be “raft”. Changing it to 1 would select “ibft”, go ahead and give that a shot and then run terraform plan.

Woah! It’s going to delete and recreate that environment, as well as the app credential and node associated with the environment. This makes sense though because app credentials and nodes depend on an environment to house them. It’s important to carefully read the output of “terraform plan”, as well as “terraform apply” to make sure you understand and desire the changes.


Cleaning up the environment requires a simple “terraform destroy” which will destroy all artifacts related to the Terraform file. Today we merely scratched the surface with HashiCorp’s Terraform and the Kaleido Terraform Provider. You can find out more about HashiCorp’s Terraform project via and keep checking for documentation.

Prev Consensys Venture Kaleido Invests in APAC in Collaboration with Amazon Web Services to Satisfy Surging Enterprise Demand for Blockchain Next Kaleido meets MetaMask