Docker image for the terraform module generator https://github.com/sudokar/generator-tf-module
1.7K
Scaffolding for new Terraform module projects
https://github.com/sudokar/generator-tf-module
main.tf, variables.tf,outputs.tf files to module root path
.editorconfig, .gitignore, .gitattributes and .terraform-version files to module root path
Option to choose test framework
test directory with an example test based on test framework selection
.pre-commit-config.yaml for terraform fmt, terraform-docs, check-merge-conflict and (go fmt, golint) / rubocop
example directory with module usage tf files
pro tip: use tfenvTo use the included generator execute the below command in shell and provide your answers to the prompts.
> docker run --rm -it -v $PWD:/generated sudokar/generator-tf-module
...
? Enter name for the new terraform module : example-module
? Enter description for the new terraform module : Example terraform module
? Enter author name : sudokar
? Choose terraform version (Use arrow keys)
❯ 0.12
0.11
? Choose test framework (Use arrow keys)
❯ Terratest
kitchen-terraform
Project layout generated for the new module with Terratest selection
example-module
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .pre-commit-config.yaml
├── .terraform-version
├── README.md
├── main.tf
├── outputs.tf
├── variables.tf
├── example
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── test
└── example_test.go
Project layout generated for the new module with kitchen-terraform selection
example-module
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .pre-commit-config.yaml
├── .terraform-version
├── .ruby-version
├── .kitchen.yml
├── Gemfile
├── README.md
├── main.tf
├── outputs.tf
├── variables.tf
├── example
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── test
└── integration
└── default
└── example_spec.rb
Step 1
On the generated module's root path, Initialize git repository
git init
Step 2
On the generated module's root path, Install pre-commit hooks
pre-commit install
Step 3 (Applicable only for terratest)
For golang tests, get below libs
> go get github.com/gruntwork-io/terratest/modules/terraform
> go get github.com/stretchr/testify/assert
This project is authored and maintained by sudokar
MIT
Content type
Image
Digest
Size
91.2 MB
Last updated
over 4 years ago
docker pull sudokar/generator-tf-module