Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding Terraform Docs #44

Merged
merged 8 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/terraform-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
'on':
workflow_call:
inputs:
coreone marked this conversation as resolved.
Show resolved Hide resolved
config_file:
description: The path to the configuration file.
default: '.terraform-docs.yml'
required: false
type: string
git_push:
description: If set to true, push the changes to the repository.
default: false
required: false
type: boolean
jobs_run_on:
default: ubuntu-latest
description: The runner group on which jobs will run.
required: false
type: string
output_file:
description: The path to the output file.
default: 'README.md'
required: false
type: string
output_method:
description: The method to use for output.
default: 'inject'
required: false
type: string
terragrunt_directory:
default: 'prod'
description: The environment directory from which Terragrunt should run.
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
required: false
type: number
use_terragrunt:
default: false
description: If set to true, use Terragrunt instead of Terraform.
required: false
type: boolean
working_directory:
description: |
The working directory where all jobs should be executed.
Comma separated list of directories to generate docs for.
default: '.'
required: false
type: string

jobs:
terraform-docs:
defaults:
run:
working-directory: ${{ inputs.working_directory }}
if: ${{ !inputs.use_terragrunt && github.actor != 'dependabot[bot]' }}
runs-on: ${{ inputs.jobs_run_on }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Render terraform docs inside the README.md
uses: terraform-docs/[email protected]
with:
config-file: ${{ inputs.config_file }}
git-push: ${{ inputs.git_push }}
output-file: ${{ inputs.output_file }}
output-method: ${{ inputs.output_method }}
working-dir: ${{ inputs.working_directory }}
timeout-minutes: ${{ inputs.timeout_minutes }}

terragrunt-docs:
defaults:
run:
working-directory: ${{ inputs.working_directory }}
env:
DISABLE_INIT: true
if: ${{ inputs.use_terragrunt && github.actor != 'dependabot[bot]' }}
runs-on: ${{ inputs.jobs_run_on }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Render terraform docs inside the README.md
uses: terraform-docs/[email protected]
with:
working-dir: ${{ inputs.working_directory }}
config-file: ${{ inputs.config_file }}
output-file: ${{ inputs.output_file }}
output-method: ${{ inputs.output_method }}
git-push: ${{ inputs.git_push }}
timeout-minutes: ${{ inputs.timeout_minutes }}
21 changes: 21 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: shared-workflows
description: Grafana is an open-source platform for monitoring and observability.
tags:
- bits
- bits-tools
- github

annotations:
github.com/project-slug: broadinstitute/shared-workflows
# backstage.io/techdocs-ref: dir:.

spec:
type: library
# system: tbd
# domain: tbd
lifecycle: production
owner: devnull
1 change: 1 addition & 0 deletions docs/index.md
8 changes: 8 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
site_name: 'GitHub Actions for Broad Institute Shared Workflows'

nav:
- Home: index.md

plugins:
- techdocs-core