Skip to content

GitHub Action to auto generated documentation for a terraform module monorepo

Notifications You must be signed in to change notification settings

lukegriffith/tf-config-docs

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

Tf-Config-Docs

Project utilises the hashicorp/terraform-config-inspect golang library to obtain high level metadata about a given terraform codebase, and has a react app that presents a user interface for it. Future features will include a query search for similar modules, versions, etc and anayltics on the codebase.

Project can easily be added to any terraform codebase in github, by adding the action to render the documents website, this will overwrite the target branch (docs by default) ./docs folder

Example

A fork of the eks module has been used to demonstrate the potentail of the project;

Example Site

Usage

Enable github pages on the given repository, and set the branch to docs, with the folder being ./docs.

Add the following workflow to .github/workflows/actions.yaml

Currently, the docs branch needs to be unprotected for this action to work.

name: 'Terraform Documentation'
on:
  push:
    branches:
      - master

jobs:
  main:
    name: build docs
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Terraform Docs Build
      uses: lukegriffith/tf-config-docs@v0.1.22

If the github pages documentation shows a module as /workspace/github, use the following configuration;


name: 'Terraform Documentation'
on:
  push:
    branches:
      - master

jobs:
  main:
    name: build docs
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Terraform Docs Build
      uses: lukegriffith/tf-config-docs@v0.1.22
      with:
        tf-module-load-env-name: true
      env:
        WORKDIR_FRIENDLY_NAME: ${{ github.repository }}