Skip to content

Commit 1433fea

Browse files
committed
chore: update pre-commit config source
1 parent bd889cd commit 1433fea

3 files changed

Lines changed: 67 additions & 37 deletions

File tree

.pre-commit-config.yaml

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
1+
# Canonical pre-commit configuration for tfroot-* repositories.
2+
# This file is bundled into the tfroot-runner container image to pre-cache hooks.
3+
# It is also fetched by the shared OpenTofu workflow at CI time.
4+
#
5+
# To update hooks for all tfroot repos, modify this file and rebuild the image.
16
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v6.0.0
4-
hooks:
5-
- id: check-case-conflict
6-
- id: check-merge-conflict
7-
- id: check-symlinks
8-
- id: check-vcs-permalinks
9-
- id: destroyed-symlinks
10-
- id: detect-private-key
11-
- id: mixed-line-ending
12-
- id: trailing-whitespace
13-
- repo: https://github.com/antonbabenko/pre-commit-terraform
14-
rev: v1.105.0
15-
hooks:
16-
- id: terraform_validate
17-
args:
18-
- --hook-config=--retry-once-with-cleanup=true
19-
- --args=-no-color
20-
- --tf-init-args=-reconfigure
21-
- --tf-init-args=-upgrade
22-
- id: terraform_tflint
23-
args:
24-
- --args=--minimum-failure-severity=error
25-
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
26-
- id: terraform_checkov
27-
args:
28-
- --args=--config-file __GIT_WORKING_DIR__/.checkov.yml
29-
- id: terraform_fmt
30-
args:
31-
- --args=-no-color
32-
- --args=-diff
33-
- --args=-recursive
34-
- id: terraform_docs
35-
args:
36-
- --args=--config=.terraform-docs.yml
7+
- repo: https://github.com/compilerla/conventional-pre-commit
8+
rev: v4.3.0
9+
hooks:
10+
- id: conventional-pre-commit
11+
stages: [commit-msg]
12+
- repo: https://github.com/antonbabenko/pre-commit-terraform
13+
rev: v1.105.0
14+
hooks:
15+
- id: terraform_validate
16+
args:
17+
- --hook-config=--retry-once-with-cleanup=true
18+
- --args=-no-color
19+
- --tf-init-args=-reconfigure
20+
- --tf-init-args=-upgrade
21+
- --tf-init-args=-backend=false
22+
- id: terraform_tflint
23+
args:
24+
- --args=--minimum-failure-severity=error
25+
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
26+
- id: terraform_checkov
27+
args:
28+
- --args=--config-file __GIT_WORKING_DIR__/.checkov.yml
29+
- id: terraform_fmt
30+
args:
31+
- --args=-no-color
32+
- --args=-diff
33+
- --args=-recursive
34+
- id: terraform_docs
35+
args:
36+
- --args=--config=.terraform-docs.yml
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v6.0.0
39+
hooks:
40+
- id: check-case-conflict
41+
- id: check-merge-conflict
42+
- id: check-symlinks
43+
- id: check-vcs-permalinks
44+
- id: destroyed-symlinks
45+
- id: detect-private-key
46+
- id: end-of-file-fixer
47+
exclude: README.md
48+
- id: mixed-line-ending
49+
- id: trailing-whitespace

AGENTS.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
# Operational Context
22
- **Type:** Terraform Module
3-
- **Test:** `pre-commit run -a`
3+
- **Test:** `make test`
44
- **Lint:** `tflint`, `terraform fmt`
5+
6+
## Pre-commit Configuration
7+
8+
Pre-commit configuration is **centralized** in `makeitworkcloud/shared-workflows/tfroot-pre-commit-config.yaml`. The CI workflow fetches this config at runtime.
9+
10+
**Do not** modify `.pre-commit-config.yaml` in this repository.
11+
12+
For local development, run:
13+
```bash
14+
make test
15+
```
16+
17+
This automatically fetches the canonical config if not present.

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ help:
2121
init:
2222
@${TERRAFORM} init -backend=false -upgrade
2323

24-
test: .git/hooks/pre-commit
24+
test: .pre-commit-config.yaml .git/hooks/pre-commit
2525
@pre-commit run -a
2626

27+
.pre-commit-config.yaml:
28+
@curl -sSL -o .pre-commit-config.yaml \
29+
https://raw.githubusercontent.com/makeitworkcloud/shared-workflows/main/tfroot-pre-commit-config.yaml
30+
2731
DEPS_PRE_COMMIT=$(shell which pre-commit || echo "pre-commit not found")
2832
DEPS_TERRAFORM_DOCS=$(shell which terraform-docs || echo "terraform-docs not found")
2933
DEPS_TFLINT=$(shell which tflint || echo "tflint not found")

0 commit comments

Comments
 (0)