Basic template for a terraform module, adhering to the Standard Module Structure and including TFLint profile and EditorConfig.
Includes example resources using Terraform local file and terraform_data.
This repository is set as a GitHub template.
To create your own module, use the "Use this template" button at the top right in Github
Structure is based on the Standard Module Structure with extra breakdowns for readability and quick comprehension.
File | Purpose |
---|---|
main.tf | Entry point |
providers.tf | Registered providers |
locals.tf | Local variables |
outputs.tf | Module outputs |
variables.tf | Variables expected by the module |
d-* | Data sources |
m-* | Modules used |
r-* | Child resources |
File | Purpose |
---|---|
.tflint.hcl | TFLint configuration |
.editorconfig | EditorConfig configuration |
README.example.md | Example README.md for a module |
This includes a TFLint config with all base rules enabled. Can be run manually or preferrably via pre-commit
- Install https://github.com/terraform-linters/tflint
tflint --config=./.tflint.hcl
For a real module, remove the final line excluding .terraform.lock.hcl
. This should be used to ensure providers are consistent and changes can be reviewed clearly.