terraform-module-library

Build reusable Terraform modules for AWS, Azure, and GCP infrastructure following infrastructure-as-code best practices. Use when creating infrastructure modules, standardizing cloud provisioning, or implementing reusable IaC components.

Author

Install

Hot:0

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-terraform-module-library&locale=en&source=copy

Terraform Module Library — Production-Grade Infrastructure Module Library

Skill Overview


Terraform Module Library provides production-ready, reusable Terraform modules across AWS, Azure, and GCP. It helps teams establish standardized Infrastructure as Code (IaC) practices.

Use Cases

1. Build Reusable Infrastructure Components


When you need standardized, reusable Terraform modules for common resources such as VPCs, Kubernetes clusters, and databases, this skill offers a complete module structure template. It includes standard files like main.tf, variables.tf, outputs.tf, and versions.tf, as well as example code and a testing framework.

2. Standardize Infrastructure Across Multi-Cloud Environments


When your organization needs to unify infrastructure deployment patterns across AWS, Azure, and GCP, this skill provides cross-cloud module design patterns. It helps establish organization-wide Terraform standards, including variable validation, resource tagging, output design, and other best practices.

3. Implement IaC Best Practices and Module Testing


When you need to write high-quality, testable Terraform modules, this skill covers the full development process—including input validation, conditional resources, module composition, and Terratest integration tests—to ensure the modules are production-ready.

Core Features

Standard Module Structure Templates


Provides a validated Terraform module directory structure, including main resource definitions, input variables, output values, version locking, README documentation, usage examples, and Terratest test files. Supports common resource types such as AWS VPC, EKS, RDS, and S3; Azure VNet, AKS, and Storage; and GCP VPC, GKE, and Cloud SQL.

Input Validation and Best Practices


Includes production-grade features such as built-in variable validation blocks (validation), conditional resource creation (count / for_each), merged resource tags, and semantic version control. Provides detailed module composition examples showing how to connect multiple modules using module outputs to build a complete infrastructure stack.

Complete Testing and Example Code


Each module comes with examples/complete/ usage examples and tests/ Terratest test files to help verify module functionality. It enables module developers to quickly validate changes and ensures that upgrading modules does not break existing functionality.

Frequently Asked Questions

What is the basic structure of a Terraform module?


A standard Terraform module includes main.tf (main resource definitions), variables.tf (input variable declarations), outputs.tf (output value definitions), and versions.tf (Provider version locking). Optional components include README.md, an examples/ directory for examples, and a tests/ directory for tests. Variables should include description and an optional validation block; outputs should expose the resource attributes that module users need.

How do you write a reusable Terraform module?


Follow these principles: use variables instead of hard-coded values, provide sensible default values, add variable validation, output key attributes for module composition, use the merge() function to support tag customization, use count or for_each for conditional resource creation, and provide complete usage examples and tests. Also follow semantic version control by locking Provider versions in versions.tf.

How does a Terraform module perform input validation?


Use a validation block to verify variable values, such as CIDR format checks and instance type allowlists. If validation fails, it displays a custom error message to help users quickly identify issues. For complex validation logic, you can combine functions like can() and regex(). The skill’s example modules demonstrate common validation patterns.