Summary
Simplify the CI pipeline by skipping terraform_docs in GitHub Actions and relying on local pre-commit hooks for documentation generation.
Problem
The terraform_docs hook in CI causes frequent failures due to:
- Environment parity issues: macOS (local) vs Linux (CI) produce different outputs
- Version mismatches: Different terraform-docs versions between local and CI environments
- Unnecessary CI complexity: Installing and maintaining terraform-docs in CI adds overhead
- Blocking releases: Documentation generation differences block merges and releases
Proposed Solution
Implement the same approach successfully deployed in terraform-aws-ecrpublic:
CI Workflow Changes
- Add
SKIP: terraform_docs environment variable to pre-commit step
- Remove terraform-docs installation from CI
- Remove
.md files from paths filter (docs changes don't need CI validation)
- Update cache key to bust stale caches
Strategy
| Layer |
Checks |
| CI |
terraform_fmt, terraform_validate, tflint, file formatting |
| Local |
Full pre-commit including terraform_docs |
| AI Review |
Documentation accuracy and quality gate |
Benefits
- Faster CI: No terraform-docs installation or execution
- Fewer false failures: Eliminates environment parity issues
- Focus on shipping: Developers can focus on features and fixes
- Maintained quality: Local pre-commit ensures docs are updated before commit
Implementation
# In pre-commit workflow
- name: Run pre-commit checks
env:
SKIP: terraform_docs
run: |
pre-commit run --all-files
Reference
Summary
Simplify the CI pipeline by skipping
terraform_docsin GitHub Actions and relying on local pre-commit hooks for documentation generation.Problem
The
terraform_docshook in CI causes frequent failures due to:Proposed Solution
Implement the same approach successfully deployed in terraform-aws-ecrpublic:
CI Workflow Changes
SKIP: terraform_docsenvironment variable to pre-commit step.mdfiles from paths filter (docs changes don't need CI validation)Strategy
terraform_fmt,terraform_validate,tflint, file formattingterraform_docsBenefits
Implementation
Reference