-
-
Notifications
You must be signed in to change notification settings - Fork 631
feat(infrastructure): add terraform-docs generation #4501
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
Draft
zeel2104
wants to merge
2
commits into
OWASP:main
Choose a base branch
from
zeel2104:feat/terraform-docs-generation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -40,6 +40,15 @@ repos: | |
| args: | ||
| - --args=--config=__GIT_WORKING_DIR__/infrastructure/.tflint.hcl | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: terraform_docs | ||
| name: terraform-docs | ||
| entry: python infrastructure/scripts/terraform_docs.py | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can use this pre-commit hook instead: https://terraform-docs.io/how-to/pre-commit-hooks/ |
||
| language: system | ||
| files: ^(infrastructure/.*\.tf|infrastructure/\.terraform-docs\.yml|infrastructure/scripts/terraform_docs\.py)$ | ||
| pass_filenames: false | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: aca6d4c8045a504e2812ea4bedff1d0a09e437bc # v0.15.8 | ||
| hooks: | ||
|
|
||
This file contains hidden or 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,15 @@ | ||
| formatter: markdown table | ||
| output: | ||
| file: README.md | ||
| mode: inject | ||
| sections: | ||
| show: | ||
| - providers | ||
| - requirements | ||
| - resources | ||
| - modules | ||
| - inputs | ||
| - outputs | ||
| settings: | ||
| hide-empty: true | ||
| html: false |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: OWASP/Nest
Length of output: 88
🏁 Script executed:
Repository: OWASP/Nest
Length of output: 821
🏁 Script executed:
Repository: OWASP/Nest
Length of output: 438
🏁 Script executed:
Repository: OWASP/Nest
Length of output: 887
🌐 Web query:
terraform-docs github releases sha256sum checksum verification💡 Result:
To verify terraform-docs binary downloads from GitHub releases using SHA256 checksums: 1. Go to the official releases page: https://github.com/terraform-docs/terraform-docs/releases 2. Download the appropriate binary archive (tar.gz for Unix, zip for Windows) for your platform and the desired version, e.g., terraform-docs-v0.22.0-linux-amd64.tar.gz. 3. Download the corresponding terraform-docs-vX.Y.Z.sha256sum file from the same release assets. This file contains SHA256 checksums for all platform binaries. 4. Extract the binary if needed (tar -xzf terraform-docs-vX.Y.Z-PLATFORM.tar.gz). 5. Verify the checksum: - Linux/macOS: sha256sum -c terraform-docs-vX.Y.Z.sha256sum --ignore-missing (checks only the downloaded file). - macOS alternative: shasum -a 256 -c terraform-docs-vX.Y.Z.sha256sum --ignore-missing. Expected output: terraform-docs-vX.Y.Z-PLATFORM.tar.gz: OK Example for latest release (v0.22.0 as of 2026-04-07): - SHA256 for linux-amd64.tar.gz: b44fb93405a610153a0a04546c78ebf294e2a0d23500bd6cacfaf115634fda9d (from release page snippet). Official installation instructions recommend direct curl download but do not explicitly mention verification. However, releases include .sha256sum files (confirmed in v0.17.0, v0.20.0 releases) and individual asset SHA256 hashes displayed on the page, generated by GoReleaser. Unlike HashiCorp Terraform (which provides SHA256SUMS + .sig for GPG), terraform-docs does not publish GPG signatures. GitHub's release integrity + checksum matching provides sufficient verification for integrity. Latest release: v0.22.0 (2026-04-07). Always check the specific release page for current checksums.
Citations:
Verify release artifact integrity before installing terraform-docs.
The step downloads and installs an external binary without checksum verification. terraform-docs releases include .sha256sum files containing checksums for all platform binaries; add hash verification to reduce CI supply-chain risk.
🔐 Suggested hardening patch
- name: Install terraform-docs run: | + set -euo pipefail TERRAFORM_DOCS_VERSION=0.20.0 - curl -sSL \ - "https://github.com/terraform-docs/terraform-docs/releases/download/v${TERRAFORM_DOCS_VERSION}/terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz" \ - | tar -xz terraform-docs - sudo mv terraform-docs /usr/local/bin/terraform-docs + ARCHIVE="terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz" + BASE_URL="https://github.com/terraform-docs/terraform-docs/releases/download/v${TERRAFORM_DOCS_VERSION}" + curl -fsSLO "${BASE_URL}/${ARCHIVE}" + curl -fsSLO "${BASE_URL}/terraform-docs-v${TERRAFORM_DOCS_VERSION}.sha256sum" + grep " ${ARCHIVE}$" "terraform-docs-v${TERRAFORM_DOCS_VERSION}.sha256sum" | sha256sum -c - + tar -xzf "${ARCHIVE}" terraform-docs + sudo install -m 0755 terraform-docs /usr/local/bin/terraform-docs🤖 Prompt for AI Agents