rossedman/tfmetrics
Scan every Terraform repo in your GitHub org and emit one consistent set of metrics: inventory, version drift, module adoption and hygiene. No init, no plan, no state.
brew install rossedman/tap/tfmetrics
The problem
Which version of the EKS module are three hundred repos on? Which roots have no required_version? Answering means running terraform init everywhere or grepping and hoping. tfmetrics parses the HCL on disk and counts, the same way for every repo.
Core ideas
tfmetrics sorts directories into roots and children, records what it finds as plain JSON, and scores the result against checks you can reweight.
A root has a backend, a cloud block or a configured provider. Everything else is a child module.
live/prod root s3
live/staging root cloud
modules/vpc child -
Each repo becomes one JSON file. Re-aggregate it with new weights or labels without cloning again.
"address": "github.com/acme/tf-iam",
"source_kind": "git",
"version": "",
"pinned": "none"
Pinned modules weigh most. Weights are yours to change, and a check with nothing to check passes.
pinned 30 x 5/6
described 15 x 4/8
provider_constraints 15 x 2/5
required_version 15 x 1/2
typed_vars 15 x 3/4
parse_clean 10 x 4/5
=> 65.3
Why tfmetrics
Per-org name, topic and custom-property filters with excludes, or --local-dir for clones you already have.
Facts are cached by commit SHA. A repo whose HEAD matches is not even cloned.
Never runs terraform, never reads state, never evaluates an expression. It needs a GitHub token and nothing else.
tf_module_versions_behind counts the newer major.minor release lines a pinned module has missed.
JSON, OpenMetrics file or Pushgateway, OTLP over gRPC, CSV, Parquet and a Markdown report for PRs.
A file that will not parse becomes a diagnostic and a tf_parse_errors count. The scan goes on.
Quick start
You need Go and a directory with Terraform in it. No token, no cloud account.
Full getting-started guide$ brew install rossedman/tap/tfmetrics
Writes one facts file.
$ tfmetrics scan ./infra
Inventory, score, pinning and diagnostics.
$ tfmetrics explain facts/
Drop --offline to add version drift.
$ tfmetrics aggregate facts/ --offline --sink openmetrics
Documentation