-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(readme): add terraform docs automation
Add terraform docs script along with makefile target and gihub action for same Signed-off-by: Timothy MacDonald <tim.macdonald@lacework.net>
- Loading branch information
Showing
5 changed files
with
57 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Generate terraform docs | ||
on: | ||
- pull_request | ||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Render terraform docs inside the README.md and push changes back to PR branch | ||
uses: terraform-docs/gh-actions@v1.0.0 | ||
with: | ||
working-dir: . | ||
output-file: README.md | ||
output-method: inject | ||
git-push: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
formatter: "markdown" | ||
version: "0.16.0" | ||
output: | ||
file: README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
if which terraform-docs >/dev/null; then | ||
terraform-docs . | ||
elif which docker >/dev/null; then | ||
echo "## terraform-docs not found in PATH, but docker was found" | ||
echo "## running terraform-docs in docker" | ||
terraform_docs_version=$(cat .terraform-docs.yml | grep version | cut -d\" -f 2) | ||
docker run --rm -v `pwd`:/data cytopia/terraform-docs:${terraform_docs_version} terraform-docs . | ||
else | ||
echo "## terraform-docs not found in PATH, neither was docker" | ||
echo "## please install terraform-docs or docker" | ||
exit 1 | ||
fi |