This blog post was originally published on camptocamp.com
About 4 years 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.
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 visualize and query them?
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.
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).
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.
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.
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.
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:
docker run -d -p 8080:8080 \ -e AWS_REGION=<AWS_DEFAULT_REGION> \ -e AWS_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID> \ -e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \ -e AWS_BUCKET=<terraform-bucket> \ -e AWS_DYNAMODB_TABLE=<terraform-locks-table> \ -e DB_PASSWORD="mygreatpasswd" \ --link postgres:db \ camptocamp/terraboard:latest
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.