Skip to content

Instantly share code, notes, and snippets.

@mahalel
Created December 9, 2022 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahalel/5eb1e53832c95643025501e804dda60d to your computer and use it in GitHub Desktop.
Save mahalel/5eb1e53832c95643025501e804dda60d to your computer and use it in GitHub Desktop.
pre-commit bootstrap
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.76.0
hooks:
- id: terraform_fmt
- id: terraform_validate
- id: terraform_docs
args:
- --hook-config=--path-to-file=README.md
- --hook-config=--add-to-existing-file=true
- --hook-config=--create-file-if-not-exist=true
- id: terraform_tflint
- id: infracost_breakdown
args:
- --env-vars=INFRACOST_API_KEY=API_KEY
- --args=--path=./
- --args=--terraform-var-file="terraform.tfvars"
verbose: true
- id: tfupdate
- id: tfupdate
name: Autoupdate Azurerm provider versions
args:
- --args=provider azurerm
- id: terraform_checkov
args:
- --args=--quiet
- --args=--skip-check CKV2_AZURE_1
- --args=--skip-check CKV_AZURE_3
config {
format = "compact"
}
plugin "azurerm" {
enabled = true
version = "0.19.0"
source = "github.com/terraform-linters/tflint-ruleset-azurerm"
}
plugin "terraform" {
enabled = true
preset = "all"
}
#!/usr/bin/sh
echo "Configuring pre-commit hook..."
# make a symbolic link with the pre-commit hook
if [ ! -f ./git/hooks/pre-commit ]; then
ln git-hooks/pre-commit.sh .git/hooks/pre-commit
echo "Done"
else
cat <<EOF
A pre-commit hook exists already.
EOF
fi
#!/usr/bin/env bash
TAG=nightly
docker run -e "USERID=$(id -u):$(id -g)" -v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a
@star3am
Copy link

star3am commented Feb 8, 2024

@mahalel
Copy link
Author

mahalel commented Feb 8, 2024

Hi @mahalel you might also be interested in https://github.com/star3am/terraform-modules-library

Hey, thanks @star3am - I will have a look. For what it's worth I've been mainly using a nix flake to control my dev environment and it's working pretty well, most of the time :D

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