/terraform-module-example

Terraform module use as an example to start new module. It includes all the automation (versioning, providers update, lint, security) and best practices from HashiCorp

Primary LanguageHCLApache License 2.0Apache-2.0

Terraform module example

Latest Release Build Status License

A Terraform module uses as a template to start new Terraform module.

It includes all the module automation (versioning, providers update, lint, security) and best practices from HashiCorp.

  • Pre-commit: enforce checks on the module before commit
  • Semantic Release: automate the release and version process
  • Reviewdog: automate the review process with per code line comments (TFLint & TFSec checks)
  • Renovate: automate the dependency management (update provider version, etc.)
  • ShiftLeft SCAN: security audit tool to detect security flaws in application and infrastructure code

Usage

Called from this Git repository

If you want to use this module inside your project, you can use the following code (change the tag to the latest version):

module "module-template" {
  source = "git::https://github.com/timoa/terraform-module-example.git?ref=tags/0.0.2"
}

Output example

terraform init
terraform plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # time_static.update will be created
  + resource "time_static" "update" {
      + day     = (known after apply)
      + hour    = (known after apply)
      + id      = (known after apply)
      + minute  = (known after apply)
      + month   = (known after apply)
      + rfc3339 = (known after apply)
      + second  = (known after apply)
      + unix    = (known after apply)
      + year    = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + labels = {
      + businessunit = "mycompany"
      + environment  = "dev"
      + project      = "my-project"
      + team         = "devops"
      + terraform    = "true"
      + updated      = (known after apply)
    }