Terraform module structure - answerdigital/terraform-modules GitHub Wiki
Modules should follow the Standard Module Structure from Terraform:
README.md- Documentation for the module:- Intro and purpose
- terraform-docs output (use
<-- {BEGIN|END}_TF_DOCS -->fences) - Example usage
versions.tf- Minimum Terraform and provider versionsvariables.tf- Variable inputsoutputs.tf- Output definitionsdata.tf- Data sourceslocals.tf- Local variables- Either:
main.tf- All the resources in a simple module*.tf- Logical clusters of discrete "features" within a module
Unlike the Terraform documentation, we don't suggest creating a base set of files even if they're empty - just omit that file until it's needed.