Skip to content

Commit

Permalink
config: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
saumitra-dev committed Jul 29, 2024
1 parent 04d8b6d commit 1486977
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 39 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/documentation.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pre-Commit
name: Terraform Checks

on:
push:
Expand All @@ -15,8 +15,26 @@ env:
TFLINT_VERSION: v0.52.0

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.8.4"

- name: Initialize Terraform
id: init
run: terraform init -input=false

- name: Terraform Test
id: fmt
run: terraform test

collectInputs:
name: Collect workflow inputs
needs: test
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.dirs.outputs.directories }}
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/terraform-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Terraform Docs

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

env:
TERRAFORM_DOCS_VERSION: v0.18.0

jobs:
generateDocs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Render and Push terraform docs for main and modules
uses: terraform-docs/gh-actions@main
with:
working-dir: .
git-push: true
config-file: .terraform-docs.yaml

- name: Render and Push terraform docs for examples
uses: terraform-docs/gh-actions@main
with:
working-dir: .
git-push: true
config-file: .terraform-docs-example.yaml
37 changes: 37 additions & 0 deletions .terraform-docs-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
formatter: "markdown table"

header-from: .header.md
footer-from: ""

recursive:
enabled: true
path: examples
include-main: false

output:
file: "README.md"
mode: replace
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
{{- printf "\n" -}}
sort:
enabled: true
by: name

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: true
read-comments: true
required: true
sensitive: true
type: true

0 comments on commit 1486977

Please sign in to comment.