Skip to content

This repository provides a foundational template for creating reusable Terraform modules. It establishes a standardized structure and includes essential files to streamline the development of consistent and maintainable infrastructure as code.

License

Notifications You must be signed in to change notification settings

sms-data-products/terraform-module-template

Repository files navigation

terraform-module-template

This module creates example resources for demonstration purposes

References

N/A

Table of Contents

Usage

See the examples folder for examples of how to utilize this module with Terraform and Terragrunt.

Pre-requisites

N/A

Quick Start

terraform init
terraform plan
terraform apply

Requirements

Name Version
terraform ~> 1.11.0
aws ~> 5.97.0
null ~> 3.2.4

Providers

Name Version
aws 5.97.0
null 3.2.4

Modules

No modules.

Resources

Name Type
null_resource.foo resource
aws_partition.current data source

Inputs

Name Description Type Default Required
example Example variable string "default value" no

Outputs

Name Description
example_value Example variable
null_resource_id An arbitrary value that changes each time the resource is replaced.
partition AWS partition in which Terraform is working

Contributing

Code quality and security will be validated before merge requests are accepted.

Tools

These tools are used to ensure validation and standardization of Terraform deployments

Must be installed

Provided by Terraform

For more information see - pre-commit-hooks-for-terraform

Setting up Trivy pre-commit hook

Trivy is used to scan Terraform configurations for potential security issues. The pre-commit hook is configured in the .pre-commit-config.yaml file using pre-commit-trivy:

repos:
- repo: https://github.com/mxab/pre-commit-trivy.git
  rev: v0.15.0
  hooks:
  - id: trivyfs-docker
    args:
      - --skip-dirs
      - ./tests
      - . # scan path
  - id: trivyconfig-docker
    args:
      - --skip-dirs
      - ./tests
      - . # scan path

This configuration:

  • Uses Docker to run trivy scans (no local installation needed)
  • Performs both filesystem and configuration scanning
  • Skips the tests directory
  • Creates a local .pre-commit-trivy-cache directory for caching

To submit a merge request

git checkout -b <branch name>
pre-commit autoupdate
pre-commit run -a
git commit -a -m 'Add new feature'
git push origin <branch name>

Optionally run the following to automate the execution of pre-commit on every git commit.

pre-commit install

License

Copyright (c) 2025

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

This repository provides a foundational template for creating reusable Terraform modules. It establishes a standardized structure and includes essential files to streamline the development of consistent and maintainable infrastructure as code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages