This is a template repo acting as a boilerplate for new Terraform configs. It contains a set of files that will help you keep the repo clean and well-documented.
The best way to use this template is by using the GitHub CLI (gh). It allows you to create a new Terraform config repository from this template, without leaving your terminal.
The advantage over a classical fork is that the resulting repo has no relationship with the template repo, no upstream remote to clean.
A simple example to create a new config as a private repo, and clone it locally:
gh repo create my-tf-config --template kral2/terraform-generic-template --private --cloneImportant
Do not forget to update your files to make this config yours!
- repo's documentation and license:
README.md,CHANGELOG.md, andLICENSEfiles - the *.tf files:
main.tf,providers.tf, andvariables.tf
Finally, install your pre-commit hooks by running these commands:
pre-commit install
pre-commit run -aNow, commit your code as usual. You are good to go! 🚀
- .gitignore file tuned for Terraform
- .gitattributes file to ensure uniform line ending
- pre-commit hooks using the pre-commit framework
Before each commit, the following hooks will help to keep your repo clean and well-documented:
- clear trailing whitespaces
- terraform validate and terraform fmt
- terraform docs to auto-generate config documentation (version requirements, providers, inputs, outputs)
main.tfdefines the Terraform cli version and the Terraform state on Terraform Cloudproviders.tfis a boilerplate with featured providersvariables.tfis a boilerplate with utility variables and localsoutput.tfis a placeholder file for your outputs
- gh
- pre-commit
- terraform-docs
- terraform cli
- copywrite (optional)
| Name | Version |
|---|---|
| terraform | >= 1.5.0 |
No modules.
No resources.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| default_tags | a set of tags to watermark the resources you deployed with Terraform. | map(string) |
{ |
no |
No outputs.