👍 🎉 First off, thanks for taking the time to contribute! 🎉 👍
The following is a set of guidelines for contributing to <MODULE_NAME>. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
- Set up pre-commit
pre-commit install # install pre-commit (see the ## Tools used section for more infos) pre-commit autoupdate # will update the hooks of the .pre-commit-config.yaml to the latest tagged version # if there is any update : git commit -am ":wrench: autoupdate pre-commit hooks"
- Search and replace the
<MODULE_NAME>
by your... module name. - Search for the TODO string in the repo's file and customize them accordingly
- Check the release Makefile section below
- Related files :
- Makefile
- .release/*
- .releaserc
- CHANGELOG.md
- Related files :
- Update the version of Terraform to use in the
version.tf
. - Run a
make precommit
command
To facilitate testing before committing to gitlab, you have the option of running automated tests with pre-commit. Each hook enables a test that we can customize. This tool will helps us improving the feedback loop and ensure our code stays compliant, documented and that we don't insert any secrets (these are exemples of useful hooks already pre-configured in this repo).
Needed files for pre-commit hooks configuration :
- .pre-commit-config/*
- .
To ensure that the terraform code does not present any problem of typing or forgetting, we use terraform_tflint
.
To ensure an automatic correction of the terraform code and keep a good indentation, we use terraform-fmt
.
For compliance we use terraform_docs
tools, this will update the readme automatically with terraform inputs and outputs.
To check the quality of linux code and make automatic corrections, we use shellcheck
To ensure an automatic generation of markdown Table of content, the md-toc
hook is used.
Not to commit a key, access key or credential in clear on gitlab, we've set up the detect-secrets
hook
which will alert before committing chosen sensitive secrets. This hook comes with the .secrets.baseline
file to chose which secrets you want to catch.
To avoid committing aws resources presenting security vulnerabilities, we use tfsec
which allows to analyze the deployed resources and indicates what is not in accordance with good security practice rules.
pre-commit
terraform-docs
required forterraform_docs
hooks.GNU awk
is required if usingterraform-docs
older than 0.8.0 with Terraform 0.12.TFLint
required forterraform_tflint
hook.TFSec
required forterraform_tfsec
hook.
To execution automated on commit you can install pre-commit on your repo folder
pre-commit install
To perform code test manually, you must run the precommit before pushing your code like this:
pre-commit install
pre-commit run --all
Warning : Don't tag manually.
> make help
version Get current version
check-status Check current git status
check-release Check release status
major-release Do a major-release, ie : bumped first digit X+1.y.z
minor-release Do a minor-release, ie : bumped second digit x.Y+1.z
patch-release Do a patch-release, ie : bumped third digit x.y.Z+1
precommit Execute some check with precommit hook
help Show this help (Run make <target> V=1 to enable verbose)
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit commit title to 48 characters or less
- Reference issues and pull requests liberally in commit title/message
- Consider starting the commit message with an applicable :
- Put here your standard for commit message
- As we use terraform-docs, please to describe all inputs and outputs.
- Use Markdown.