Infrastructure – Actualités

Keep an eye on your Terraform states

8 août 2017

About a year ago, we started using Terraform. Many things we were doing manually in the cloud at the time are now coded. As a result, our Terraform base code now contains over a hundred states.

Terraform everything!

A lot of those resources already existed before, some managed by CloudFormation, others manually. Being able to import resources has helped a lot to integrate new Terraform code with existing infrastructure. We now have a unified system to control them, and most importantly to know who created them, how and why. Collaboration was made easier by using profiles instead of hardcoded credentials, the introduction of remote states stored on AWS S3, as well as state locks on DynamoDB.

With all this, one thing remained: how do we keep an eye on all these states, resources and locks that are stored on AWS? Could there be a way to visualise
and query them?

Introducing Terraboard

Terraboard was born in an attempt to bring an easy-to-use Web Interface for Terraform states.

It currently supports states stored in AWS S3, as well as locks on DynamoDB. It features 4 views: overview, state view, compare view and search.

Terraboard requires an S3 bucket with versioning activated (for history and comparison between versions), as well as a PostgreSQL database, where all S3 states will be stored as a data cache.

Terraboard is comprised of two compontents:

  • a server written in Go, which synchronizes the state files from the S3 bucket into the PostgreSQL database, and provides an API for the UI;
  • a Web UI written in AngularJS which consumes the API data and serves the Web pages.

Overview

The overview is the landing page in Terraboard. It provides information about the most recent version of each state, along with the Terraform version used to apply it, its serial, the number of resources it features, and an activity sparkline. Clicking the sparkline lets you easily access any version of a state.

Graphs present statistics on the main resource types and Terraform versions used, as well as the number of number of states locked (if DynamoDB is configured).

State view

The State view presents details about a state file’s resources. Resources are listed by module and can be filtered. A version selector lets you view historical data for the state.

Compare view

While on the State view, you can pick a second version to compare with the current one. This computes differences between the two versions, which displays:

  • A list of differences, displayed as a unified diff;
  • A list of resources only in the first version;
  • A list of resources only in the new version.

Search view

If you’ve ever wondered in which Terraform state a node was managed, you can easily find this out in the Search view. The Search view lets you filter resources and their attributes by type, name, key or value, as well as Terraform version used.

I want to try it!

Are you ready to try Terraboard? If you’re using Docker, this is very easy. All you need is a PostgreSQL database and your AWS credentials:

A Rancher template is also available in Camptocamp’s Rancher Catalog.

I want to help!

Terraboard is an open-source project and we heartily welcome all contributions to it. Don’t hesitate to submit Pull Requests on GitHub.

You are also welcome to join us on Gitter to discuss new ideas.

Happy Terraforming!

  1. *
  2. *
  3. *
  4. *