8000 GitHub - Excoriate/terraform-registry-module-template: A comprehensive template repository for Terraform modules with best practices and GitHub workflow integrations.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Excoriate/terraform-registry-module-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

98 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

logo

🧼 Pre-commit Hooks πŸ“š Terraform Modules CI 🦫 Go Code Quality Checks

[Your Module Name Here]

Brief description of what your Terraform module does and its primary use case.

This module provides [key functionality] for [target infrastructure/use case]. Built with production-ready practices including comprehensive testing, documentation generation, and portable CI/CD pipelines.

Tip

Quick Start: Replace the placeholders in this README with your module's specific details. The development workflow and tooling are pre-configured and ready to use. It is essential to provide a clear and comprehensive description of your module. A well-written description helps users understand the purpose and functionality of your module. For more information on how to write effective module descriptions, please refer to the Terraform Registry documentation.

✨ Features

Tip

When describing the features of your module, focus on clarity and brevity. Highlight the key functionalities and benefits without unnecessary jargon. This helps users quickly grasp what your module offers and how it can be beneficial for their projects.

This module provides:

  • πŸš€ [Feature 1]: Description of key capability
  • πŸš€ [Feature 2]: Description of key capability
  • πŸš€ [Feature 3]: Description of key capability
  • πŸ”§ Production Ready: Built-in testing, documentation, and CI/CD
  • πŸ“¦ Registry Compatible: Follows Terraform Registry best practices

For examples, see the examples/ directory.

πŸ“¦ Available Modules

Tip

Module Organization: All Terraform modules are organized in the modules/ directory following our Module Guidelines. Each module is self-contained with comprehensive documentation, examples, and tests.

Module Description Use Case
default Template module for creating new infrastructure components Starting point for new modules, demonstrates best practices
random-string-generator Generates random strings with configurable length and character sets Unique identifiers, suffixes, and random values
read-aws-metadata Retrieves AWS account metadata (Account ID, Region, Partition) Environment discovery, dynamic resource naming

Note: When creating new modules, follow the structure and patterns established in these examples. See our Module Development Guidelines for detailed specifications.

πŸ”„ Development Workflow

This template includes powerful development tooling with Dagger for portable CI/CD and Just for command orchestration.

Prerequisites

Option 1: Install tools individually

# Essential tools
brew install just dagger terraform

# Optional but recommended
brew install pre-commit terraform-docs tflint

Option 2: Use Nix for reproducible environment

# Install Nix (if not already installed)
curl -L https://nixos.org/nix/install | sh

# Enter development shell with all tools
nix develop

# Or use with direnv for automatic activation
echo "use flake" > .envrc
direnv allow

Quick Start

  1. Initialize your environment:

    just init
  2. Develop your module:

    # Edit files in modules/default/
    # Add examples in examples/default/basic/
    # Write tests in tests/modules/default/
  3. Validate as you build:

    # Run the same pipeline as CI locally
    just pipeline-infra-tf-ci default
    
    # Or run individual checks
    just tf-validate default
    just pipeline-action-terraform-static-analysis default
    just pipeline-action-terraform-build default

Available Commands

πŸ” Core Development:

just init                    # Initialize development environment
just tf-validate MODULE      # Validate Terraform code
just tf-fmt MODULE           # Format Terraform code
just tf-docs MODULE          # Generate documentation

πŸ§ͺ Testing:

just tf-test-unit MODULE     # Run unit tests
just tf-test-examples MODULE # Run example tests
just pipeline-infra-tf-ci MODULE  # Full CI pipeline locally

πŸš€ Pipeline Operations:

just pipeline-infra-build    # Build Dagger pipeline
just pipeline-infra-shell    # Interactive debugging
just pipeline-action-terraform-static-analysis MODULE

Tip

Run just to see all available commands. For detailed documentation, see our Pipeline Guide and Justfile Recipes Guide.

πŸ§ͺ Testing

Multi-layered testing approach:

  • Static Analysis: Terraform validation, formatting, and linting
  • Unit Tests: Module configuration and output validation
  • Integration Tests: End-to-end deployment with real resources
  • Example Tests: All examples are automatically tested
# Run all tests locally (same as CI)
just pipeline-infra-tf-ci default

# Run specific test types
just tf-test-unit default
just tf-test-examples default

Testing is implemented using Terratest for reliable infrastructure validation.

🌐 CI/CD

Portable pipeline that runs identically everywhere:

  • Local Development: just pipeline-infra-tf-ci MODULE
  • GitHub Actions: Automated on PRs and releases
  • Interactive Debugging: just pipeline-infra-shell

The Dagger pipeline provides:

  • Cross-version Terraform compatibility testing
  • AWS integration with multiple auth methods
  • Comprehensive static analysis and security scanning
  • Parallel execution with intelligent caching

βš™οΈ Configuration

Environment support:

  • .env files (automatically loaded by Just)
  • Environment variables
  • AWS profiles and OIDC
  • Terraform workspaces
# Example .env file
TF_VAR_environment=development
TF_VAR_region=us-west-2
AWS_PROFILE=my-dev-profile

See our Environment Variables Guide for complete configuration options.

🀝 Contributing

We welcome contributions to improve this module!

Development Standards:

  1. Fork and clone this repository
  2. Use the development environment: Either install tools individually or use our Nix flake with nix develop
  3. Follow our standards: Terraform StyleGuides
  4. Test your changes: just pipeline-infra-tf-ci default
  5. Submit a PR: We'll review promptly!

Code Quality Requirements:

  • All code must pass the complete CI pipeline
  • New features require tests and documentation
  • Follow our coding standards and best practices
  • Use conventional commits for automated changelog generation

πŸ“– Documentation

🎯 Quick Reference

πŸ—οΈ Development Standards

πŸ“‹ Project Resources

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with Terraform Registry Module Template

Production-ready tooling β€’ Portable CI/CD β€’ Comprehensive testing

About

A comprehensive template repository for Terraform modules with best practices and GitHub workflow integrations.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0