Skip to content

This repository is to be used as a Terraform Module Boilerplate to quickly get started in writing your own Terraform Modules

License

Notifications You must be signed in to change notification settings

asyrafnorafandi/terraform-modules-template

Repository files navigation

Terraform Module Template

This repository is a boilerplate to start writing your own Terraform Module

Features:

Terraform Linting & Formatting

terraform

IAC Security Scanning

Trivy

Automatic Terraform Doc Generation

Terraform Docs

Prerequisites

Install the follow tools to your local machine:

# Terraform
$ brew install terraform

# Terraform lint to enforce best practices in writing Terraform code
# Reference: https://github.com/terraform-linters/tflint
$ brew install tflint

# Trivy for IAC Security scanning
# Reference: https://github.com/aquasecurity/trivy
$ brew install trivy

# Terraform Docs to autogenerate Terraform Module documentation
# Reference: https://terraform-docs.io/user-guide/installation/
$ brew install terraform-docs

# Pre Commit hooks to enforce Terraform Docs generation on every commit
# Reference: https://pre-commit.com/#install
$ brew install pre-commit

Getting started

On the top right of this repo, click on Use this template -> Create new repository. Then fill in the name of the repository with the following format, terraform-<provider_name>-<custom_name>. Eg. terraform-aws-private-eks.

$ git clone <your_project_repository>

$ cd <your_project_repository>

# Install pre-commit hooks
$ pre-commit install-hooks

# Make code changes and try to commit. You should see the following output
Terraform fmt............................................................Passed
Terraform validate with tflint...........................................Passed
Terraform validate with trivy............................................Passed
Terraform docs...........................................................Passed

You are all set to go to write your custom Terraform Module! 🚀


Note: Everything below this line is generated via terraform-docs


Requirements

Name Version
terraform >= 1.0

Providers

No providers.

Modules

No modules.

Resources

No resources.

Inputs

No inputs.

Outputs

No outputs.

About

This repository is to be used as a Terraform Module Boilerplate to quickly get started in writing your own Terraform Modules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages