Skip to content

Latest commit

 

History

History
71 lines (64 loc) · 1.88 KB

README.md

File metadata and controls

71 lines (64 loc) · 1.88 KB

Terraform Metric Collector (TMC)

TMC is a GitHub Action that performs static analysis on Terraform Code to do a simple count of several datapoints provided through the library @evops/hcl-terraform-parser. This parser provides the engine for analysis, and this action allows for aggregation of these through snapshots in CI that allow you to analyze your team's development through time.

How to Use

- name: Generate Code Metrics for Commit
  id: metrics
  uses: offgriddev/tf-metrics-action@main
  with:
    github_token: ${{ github.token }}
    event: ${{ toJson(github.event) }}

This action has one export: export_filename. This stores the filename for the report generated by the complexity reporter.

The action will produce a report that looks like this:

{
  "actor": "offgriddev",
  "sha": "b8824d770a1ba20c41329ab92bead39ec85f25ed",
  "ref": "refs/heads/main",
  "repository": {
    "owner": "offgriddev",
    "repo": "tf-metrics-action"
  },
  "files": [
    {
      "file": "./terraform/main.tf",
      "report": {
        "path": 9,
        "variables": 0,
        "outputs": 0,
        "required_providers": 0,
        "managed_resources": 2,
        "data_resources": 0,
        "module_calls": 0
      }
    },
    {
      "file": "./terraform/providers.tf",
      "report": {
        "path": 9,
        "variables": 0,
        "outputs": 0,
        "required_providers": 1,
        "provider_configs": 1,
        "managed_resources": 0,
        "data_resources": 0,
        "module_calls": 0
      }
    },
    {
      "file": "./terraform/variables.tf",
      "report": {
        "path": 9,
        "variables": 1,
        "outputs": 0,
        "required_providers": 0,
        "managed_resources": 0,
        "data_resources": 0,
        "module_calls": 0
      }
    }
  ],
  "dateUtc": "2023-11-08T23:30:03.837Z"
}