Create a Terraform module with CICD already setup.
Report Bug
·
Request Feature
·
This "Hello World" module is a template and a guide to creating Terraform modules. Its purpose is to demonstrate Terraform module best practices and provide a template with CI/CD preconfigured.
- Local testing with pre-commit-terraform.
- Formats code with
terraform fmt
. - Validates code with
terraform validate
. - Automatic
README
updates with terraform-docs. - Static code analysis with TFLint, tfsec and checkov.
- Formats code with
- Devcontainer with dependencies pre-configured.
- CI pipeline with Github Actions:
- Reuses Devcontainer to run the same checks that run locally.
- Runs tests against the latest Terraform version.
- Runs tests against older versions of Terraform.
- CD pipeline with Github Actions:
- Create git tags using semver when PRs merge to the
main
branch. - Create Github Releases for every tag.
- Create git tags using semver when PRs merge to the
- Testing with Terratest across all major versions of Terraform.
- Shows use of module composition by combining smaller modules
- Shows how to use "Higher-order modules" to extend module functionality.
If you are creating a brand new module then using this template is pretty straight forward by using the GitHub guide.
If you are wanting to apply this template to an existing module then you will want to do the following:
- Copy the .devcontainer and .github directories.
- Update your README file/files to include the template value where you want the auto generated content from terraform-docs to go.
Regardless if you created a new module or updated an existing one, you will want to modify this entire README to be about YOUR module. Also update the CONTRIBUTING.md file with steps on how to contribute to YOUR module. The LICENSE file is optional if you are NOT publishing to the Terraform module registry.
See CONTRIBUTING.md
Distributed under the Apache-2.0 License. See LICENSE for more information.
Levi - @shady_cuz
- Release Drafter
- pre-commit-terraform
- terraform-docs
- TFLint
- tfsec
- checkov
- Terratest
- Best-README-Template
Everything below this line is generated via terraform-docs
Name | Version |
---|---|
terraform | >= 0.12.0, < 2.0.0 |
No providers.
Name | Source | Version |
---|---|---|
make_exciting | ./modules/make_exciting | n/a |
say_hello | ./modules/say_hello | n/a |
No resources.
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | The name of a person or thing to say hello to. | string |
"World" |
no |
Name | Description |
---|---|
greeting | A very exciting greeting! |