Skip to content

Commit 1bbe9f1

Browse files
committed
Add terraform fmt and validate in precommit
1 parent 2611932 commit 1bbe9f1

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,13 @@ repos:
6262
hooks:
6363
- id: pip-audit
6464
args: ["--require-hashes", "--requirement", "requirements/local.txt"]
65+
- repo: https://github.com/antonbabenko/pre-commit-terraform
66+
rev: "v1.77.2"
67+
hooks:
68+
- id: terraform_fmt
69+
- id: terraform_validate
70+
args:
71+
- --tf-init-args=-backend=false
72+
- --tf-init-args=-lock=false
73+
- --tf-init-args=-upgrade
74+
- --hook-config=--retry-once-with-cleanup=true

{{cookiecutter.project_dirname}}/.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ repos:
6969
hooks:
7070
- id: pip-audit
7171
args: ["--require-hashes", "--requirement", "requirements/remote.txt"]
72+
- repo: https://github.com/antonbabenko/pre-commit-terraform
73+
rev: "v1.77.2"
74+
hooks:
75+
- id: terraform_fmt
76+
- id: terraform_validate
77+
args:
78+
- --tf-init-args=-backend=false
79+
- --tf-init-args=-lock=false
80+
- --tf-init-args=-upgrade
81+
- --hook-config=--retry-once-with-cleanup=true
7282
- repo: https://github.com/shellcheck-py/shellcheck-py
7383
rev: v0.9.0.2
7484
hooks:

{{cookiecutter.project_dirname}}/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ RUN apt-get update \
6868
make \
6969
openssh-client \
7070
postgresql-client-13
71+
RUN curl https://apt.releases.hashicorp.com/gpg | \
72+
gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg
73+
RUN gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
74+
RUN echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
75+
tee /etc/apt/sources.list.d/hashicorp.list
76+
RUN apt-get update && apt-get --assume-yes install terraform
7177
USER $APPUSER
7278
COPY --chown=$APPUSER ./requirements/local.txt requirements/local.txt
7379
RUN python3 -m pip install --user --no-cache-dir -r requirements/local.txt

0 commit comments

Comments
 (0)