Skip to content

RoseSecurity/terrafetch

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

terrafetch-logo

Let your IaC flex for you.

Introduction

Terrafetch is the Neofetch of Terraform—because your infrastructure deserves a little flair. It scans your Terraform repository and displays key statistics like the number of variables, resources, modules, outputs, and more—all in a stylish, terminal-friendly format. Perfect for CLI screenshots, repo intros, or just flexing your infra hygiene.

Demo

terrafetch-demo

Installation

Go

If you have a functional Go environment, you can install with:

go install github.com/RoseSecurity/terrafetch@latest

Apt

To install packages, you can quickly setup the repository automatically:

curl -1sLf \
  'https://dl.cloudsmith.io/public/rosesecurity/terrafetch/setup.deb.sh' \
  | sudo -E bash

Once the repository is configured, you can install with:

apt install terrafetch

Source

git clone git@github.com:RoseSecurity/terrafetch.git
cd terrafetch
make build

Usage

Important

Do you love the tool but it's missing some information you'd like to see? Head on over to this discussion and drop a comment or open a new issue!

 ⨠ terrafetch
╭─────────────────────────────────────────────────────────────────╮
│                                    .                            │
│@#                                  -                            │
│@@@@@                               Terraform Files:     1315    │
│@@@@@@@@.                           Documentation:       192     │
│@@@@@@@@@@ +                   #    Providers:           334     │
│@@@@@@@@@@ @@@@             @@@@    Module Calls:        748     │
│@@@@@@@@@@ @@@@@@@.     .@@@@@@@    Resources:           424     │
│ @@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@    Data Sources:        288     │
│    +@@@@@ @@@@@@@@@@ @@@@@@@@@@    Variables:           6122    │
│       .@@ @@@@@@@@@@ @@@@@@@@@@    Sensitive Variables: 16      │
│           @@@@@@@@@@ @@@@@@@@@@    Outputs:             807     │
│           @+ -@@@@@@ @@@@@@=       Sensitive Outputs:   22      │
│           @@@@@ .@@@ @@@.                                       │
│           @@@@@@@@.                                             │
│           @@@@@@@@@@                                            │
│           @@@@@@@@@@                                            │
│           @@@@@@@@@@                                            │
│            .@@@@@@@@                                            │
│                @@@@@                                            │
│                   %@                                            │
│                                                                 │
╰─────────────────────────────────────────────────────────────────╯

GitHub Action

Give your infrastructure repositories some flair by injecting Terrafetch statistics right into your documentation.

  1. Add report markers somewhere in your README.md (or any file you point the action at):
<!-- TER​RAFETCH:START -->
<!-- TER​RAFETCH:END -->
  1. Make sure your repo permissions allow the default GITHUB_TOKEN to contents: write so the bot can push the updated file.

Example Workflow

name: Terrafetch

on:
  schedule:
    - cron: "0 3 * * *"   # every night at 03:00
  workflow_dispatch:        # manual trigger when you need it

permissions:
  contents: write           # let the action push changes

jobs:
  terrafetch:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Generate README stats with Terrafetch
        uses: RoseSecurity/terrafetch@v0.3.0
        with:
          terraform_directory: infra
          output_file: README.md      # file with the START/END markers
          terrafetch_version: 0.3.0   # "latest" also works
  1. Enjoy your new and improved documentation (as you can see here)
Terrafetch
╭────────────────────────────────────────────────────────────────╮
│                                    .                           │
│@#                                  -                           │
│@@@@@                               Terraform Files:     54     │
│@@@@@@@@.                           Documentation:       8      │
│@@@@@@@@@@ +                   #    Providers:           16     │
│@@@@@@@@@@ @@@@             @@@@    Module Calls:        19     │
│@@@@@@@@@@ @@@@@@@.     .@@@@@@@    Resources:           11     │
│ @@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@    Data Sources:        7      │
│    +@@@@@ @@@@@@@@@@ @@@@@@@@@@    Variables:           191    │
│       .@@ @@@@@@@@@@ @@@@@@@@@@    Sensitive Variables: 1      │
│           @@@@@@@@@@ @@@@@@@@@@    Outputs:             43     │
│           @+ -@@@@@@ @@@@@@=       Sensitive Outputs:   1      │
│           @@@@@ .@@@ @@@.                                      │
│           @@@@@@@@.                                            │
│           @@@@@@@@@@                                           │
│           @@@@@@@@@@                                           │
│           @@@@@@@@@@                                           │
│            .@@@@@@@@                                           │
│                @@@@@                                           │
│                   %@                                           │
│                                                                │
╰────────────────────────────────────────────────────────────────╯

Contributing

For bug reports & feature requests, please use the issue tracker.

PRs are welcome! We follow the typical "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull Request so that we can review your changes

Tip

Be sure to merge the latest changes from "upstream" before making a pull request!

Many Thanks to Our Contributors

About

The Neofetch of Terraform. Let your IaC flex for you.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors 3

  •  
  •  
  •