Skip to content

docs: warn that .terraform.lock.hcl corrupts terraform-docs README output - #44

Open
akuzminsky wants to merge 1 commit into
mainfrom
docs-terraform-init-lockfile
Open

docs: warn that .terraform.lock.hcl corrupts terraform-docs README output#44
akuzminsky wants to merge 1 commit into
mainfrom
docs-terraform-init-lockfile

Conversation

@akuzminsky

Copy link
Copy Markdown
Member

Summary

Adds a CRITICAL note to the centrally-managed CODING_STANDARD.md (Terraform → Documentation section)
documenting a pitfall that has now bitten twice (terraform-aws-iso27001, terraform-aws-pypiserver PR #45):

  • When .terraform.lock.hcl exists in a module root, terraform-docs writes resolved provider versions
    (e.g. 6.60.0) into README's Providers table instead of the constraints from terraform.tf
    (e.g. >= 5.11, < 7.0.0).
  • The pre-commit hook regenerates README.md during git commit and silently stages the change, so the
    committed diff can differ from the reviewed diff.

The new guidance: run terraform init in the test root (test_data/<module>/) rather than the module root,
clean up init artifacts before committing, and verify the committed diff with git show --stat.

Since CODING_STANDARD.md is injected into all managed repos via github_repository_file, the terraform plan
will show updates across every repository — that's the intended propagation.

🤖 Generated with Claude Code

…tput

When a lock file exists in the module root, terraform-docs writes resolved
provider versions into README's Providers table instead of the constraints
from terraform.tf, and the pre-commit hook silently stages the regenerated
README during commit. Document the pitfall and the safe validation workflow
in CODING_STANDARD.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Comment was too big. Check the CI workflow output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant