This guide will help you get started contributing to this repo, with instructions to setup your development environment and tips when developing.
There are some dependencies that are required to be able to run the linters, checks and formatting.
The following tools are required to be installed on your local development machine to run the validation.
A tip is to use your favorite flavor of package manager like brew
or pacman
to make the
process simpler.
If you are using macOS you will need to install a newer version of make, as the one included by default
is soon legally allowed to drink in Germany. The new make version will not remove the existing one
but instead install it as the command gmake
.
brew install make
Eeach PR has a set of checks that are required to pass before it can be merged. This is to ensure consitency and stability in each of the modules. You should run through all the make recipes before creating a PR to make sure that all of your HCL is formatted correctly.
make
# or on macOS
gmake
Creating a new module is simple but has some non-obvious requirements for all of the checks to pass. First create a new module
directory in the 'modules' directory and in a fitting category directory. After the module is created a validation configuration
needs to be created for the module. In the 'validation' directory create a new directory with the same name and path as the module.
Inside there you should create a main.tf
file which imports the module with a local path and passes dummy values for all of the
required variables, so that it is possible to run terraform validate
.
These are the steps someone without contributor access needs to take to create a pull request:
- Fork the repository using the GitHub
- If you already have a fork, make sure it is up-to-date by pressing "Sync fork" in GitHub
- Clone your fork to your local computer
git clone <github repo>
- Start a terminal inside the local repository and create a branch
git checkout -b <branch-name>
- Make all the neccesary changes
- Make sure you have the neccesary tools installed locally to run the make commands. See LOCAL_DEVELOPMENT for more details.
- Run
make all
and make sure nothing fails - Stage the changes using
git add <file>
(usegit status
to see all changed files) - Commit the changes using
git commit
and write a respectable commit message - Push the changes using
git push --set-upstream origin <branch-name>
- Go to your GitHub repository and pres "Compare & pull request"
- Choose the correct base repository (should be XenitAB/terraform-modules main branch)
- Make sure your commits and PR title conforms to conventional commits, where
type
should be one offeat
,fix
,docs
,test
,ci
,refactor
,perf
,chore
, orrevert
. Using ascope
is optional. If used, it can be the module, using the following format:module group/module
. Example:fix(azure/core): <subject>
- Make sure you allow edits by maintainers
- Then press Create pull request
- INFO: A maintainer will be required to approve the checks to run before you will receive feedback from them
- When all checks are passing and you have received an approval and a maintainer have merged the changes, press "Delete branch" in the PR
- Locally, in the terminal, check out main using
git checkout main
- Remove the local branch using
git branch -D <branch-name>
- In your GitHub fork, press "Sync fork"
- Locally, run
git pull