nicolaka / TFBI

Terraform Cloud Business Insights

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ” Terraform Business Insights (TFBI)

Business, Operational, and Adoption Insights for Terraform Cloud & Enterprise

Note: TFBI is a personal project and not associated with HashiCorp.

Summary: Terraform Cloud Business Insights (TFBI) is a tool that provides business, operational, and adoption insights for Terraform Cloud/Enterprise operators. It implements both custom Prometheus collectors and metrics to query the Terraform Cloud/Enterprise API using go-tfe Go libary and a Grafana dashboard to easily explore common business, operational, and adoption metrics.

dashboard dashboard

Metrics

API/Category Metric Name Type Description Implementation Status
Organization Organization Summary Table Organization Details βœ…
Teams Total # of Teams Gauge Current number of active teams in the organization βœ…
Teams Teams Summary Table Team Summary Table βœ…
Projects Projects Count Gauge Current number of active projects in the organization βœ…
Projects Projects Summary Table Projects Summary βœ…
Projects Projects Count Over Time Time Series Graph Time series graph showing of # number of active projects over time βœ…
Users Total # of Users Gauge Current number of active users in the organization βœ…
Workspaces Workspace Count Gauge Current number of active workspaces in the organization βœ…
Workspaces Workspaces Summary Table Workspaces Summary βœ…
Workspaces Workspaces Status Overview Chart Workspaces status distribution chart βœ…
Workspaces Terraform Version Distribution Chart Terraform version distribution chart βœ…
Workspaces Drift Detection & Continious Validation Enabled Chart Chart showing details on number / % of workspaces that enabled drift detection/continious validation βœ…
Workspaces Workspaces Count Over Time Time Series Graph Time series graph showing of # number of active workspaces over time βœ…
Workspaces Workspaces Status History Time Series Graph Time series graph showing workspace status over time βœ…
Runs Total Runs Counter Total number of runs executed βœ…
Runs Total Run Failures Counter Total number of failed runs βœ…
Resources Resources Under Management Gauge Number of Resources Under Management(RUM) βœ…
Policy Sets Policy Set Count Gauge Current number of active policy sets organization βœ…
Policy Sets Total Policy Check Failures Counter Total number of policy check failures βœ…
Policy Sets Policy Set Summary Table Policy Sets Summary βœ…
Policy Sets Policy Type Distribution Chart Policy type distribution chart βœ…
Modules Modules Count Gauge Number of Modules in the Private Module Registry βœ…
Modules No-Code Module Distribution Chart Percentage of modules that are no-code ready βœ…

Note: go-tfe and the TFC/TFE API provide much more endpoints/data that can be scraped beyond what is implemented in TFBI. Feel free to provide feedback/contributions.

Usage

  1. Clone this repo.
  2. Create a Terraform Cloud or Enterprise API Token
  3. Export your token and the name of your TFC Org:
export TF_API_TOKEN="TOKEN"
export TF_ORGANIZATIONS="ORG_NAME"
  1. Spin up the application using Docker Compose

$ docker compose up -d

[+] Running 4/4
 βœ” Network tfbi_default         Created                                                           0.0s
 βœ” Container tfbi-grafana-1     Started                                                           0.0s
 βœ” Container tfbi-prometheus-1  Started                                                           0.1s
 βœ” Container tfbi-exporter-1    Started                                                           0.1s

  1. Now you can access the dashboard using http://localhost:3000

Note: It's recommended to create a Grafana user/password and login using it, otherwise you'll continue receiving auth warning logs in Grafan.

Credits

Shoutout to Kaisen Dorks for developing terraform-cloud-exporter which I leveraged as the basis for developing TFBI. Much of the scaffloding/structure I leveraged in TFBI is based on their work, and for that I'd like to thank them.

Reporting Issues

Please raise any issues and submit any contribution by pushing a PR to this repo.

About

Terraform Cloud Business Insights

License:MIT License


Languages

Language:Go 98.9%Language:Dockerfile 1.1%