Cookiecutter template for creating Terraform modules. Modules are intended to be reused by one or many workspaces. This template is heavily influenced by the Hashicorp's minimal-module structure and the DevOps patterns used in the popular terraform-aws-eks community module.
Also checkout cookiecutter-tf-workspace.
- Should You Create A Module?
- Publishing Modules to the Terraform Cloud Private Module Registry
- Automate Terraform with GitHub Actions
$ pip install cookiecutter
$ cookiecutter git@github.com:aidanmelen/cookiecutter-tf-module.git
$ cd [MODULE_NAME]
$ make
You will be prompted for basic info (your name, module name, etc.) which will be used in the template.
This will create the following:
terraform-module-example
├── Makefile
├── README.md
├── docs
│ └── developer-notes.md
├── examples
│ ├── complete
│ │ ├── backend.tf
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ └── variables.tf
│ └── basic
│ ├── backend.tf
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── main.tf
├── outputs.tf
├── tests
├── variables.tf
└── versions.tf
That's all you need to get started.
MIT Licensed. See LICENSE for full details.
-
This project was inspired heavily by the terraform-aws-eks community module. Many thanks to the authors for all there hard work.
-
Shout-out to cjolowicz for demonstrating the power of
pre-commit
andgithub actons
in his highly recommend Hypermodern Python blog! His work creating the cookiecutter-hypermodern-python was a big inspiration in creating this template.