Skip to content

DontShaveTheYak/terraform-module-template

Repository files navigation

Python Latest Tests License


Terraform module template

Create a Terraform module with CICD already setup.
Report Bug · Request Feature ·

About The Project

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.

Features

  • 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.
  • 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:
  • 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.

Getting Started

Usage

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:

  1. Copy the .devcontainer and .github directories.
  2. 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.

Contributing

See CONTRIBUTING.md

License

Distributed under the Apache-2.0 License. See LICENSE for more information.

Contact

Levi - @shady_cuz

Acknowledgements



Everything below this line is generated via terraform-docs


Requirements

Name Version
terraform >= 0.12.0, < 2.0.0

Providers

No providers.

Modules

Name Source Version
make_exciting ./modules/make_exciting n/a
say_hello ./modules/say_hello n/a

Resources

No resources.

Inputs

Name Description Type Default Required
name The name of a person or thing to say hello to. string "World" no

Outputs

Name Description
greeting A very exciting greeting!