/tfsoa

Terraform State of Awareness Dashboard

Primary LanguageJavaScript

Terraform State of Awareness (TFSOA)

A dashboard that helps centralize and monitor disparate Terraform states.

Deploy

Heroku example quick start

Use Heroku Deploy button above and then run these API calls to put test data on your TFSOA deployment replacing app_name with the name you give your Heroku endpoint

Post an example Terraform state

curl https://APP_NAME.herokuapp.com/tfsoa/add_tf_state/dpt/product2/service1/dev/ \
  -H "Content-Type: application/json" \
  -X \
  POST -d @test/fixtures/state1

Post an associated Terraform graph example

cd test/fixtures/tf_asg/ 
terraform graph \
  | curl -d @- https://APP_NAME.herokuapp.com/tfsoa/add_tf_graph/dpt/product2/service1/dev/

TFSOA Screenshot

Versioned states with environment and version markers Per team managed states Team layout of TF states

TFSOA accepts pushes of Terraform states and digraph output.

  • Versioned backups of state
  • Generate graph visual from digraph
  • Dashboard to track useful state information

The Terraform version, JSON serial, JSON version and entire state are serialized saved. TFSOA uses this information across a multitude of states to present a single dashboard interface to view statistics on all Terraform states.

Setup database

bundle exec rake db:environment:set
bundle exec rake db:setup
bundle exec rake db:migrate

Recommended setup notes

Place behind and SSL endpoint like an Nginx, ELB or Haproxy to handle SSL. Terraform states typically contain sensative information.

System requirements

  • graphviz (used for graph .png creation)
  • libsqlite3-dev (Ubuntu)
  • nodejs (Ubuntu)
  • libmysqlclient-dev (Ubuntu)
  • ruby (Ubuntu)
  • ruby-dev (Ubuntu)
  • build-essential (Ubuntu)

Start TFSOA

rackup

This will start a rack server on port 9292

Add your first Terraform state to tfsoa

Unique identifiers for state

  • team (team name that owns this tf state)
  • product (my companies new product this supports)
  • service (service name, or project name)
  • environment (dev, stage, prod)

Example state push

curl 127.0.0.1:9292/tfsoa/add_tf_state/team/product/service/environment/ \
  -H "Content-Type: application/json" \
  -X \
  POST -d @.terraform/terraform.tfstate

Example graph push (must push graph to an existing saved state in tfsoa)

terraform graph \
| curl -d @- http://localhost:9292/tfsoa/add_tf_graph/comms/trulia/someservice/prod/

Development Notes

Current entity-relationship diagram

erd diagram

Vagrant support

vagrant up

Then navigate your browser to http://127.0.0.1:9292

Safe to run vagrant provision to restart tfsoa process if you make local code changes.

Thank you

Thanks to Smashing gem for providing a solid framework for tfsoa to utilize