thomast1906/github-copilot-agent-skills/terraform-module-creator
Claude Code and agent skill by thomast1906/github-copilot-agent-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Design and create Terraform modules from real infrastructure requirements. Use when asked to create a Terraform module, build a module from a requirement, turn repeated Terraform into a module, design module inputs and outputs, review whether a Terraform pattern should become a module, refactor existing Terraform into a reusable module, or assess whether a module is over-abstracted. Covers Azure-focused modules with KISS/DRY principles, module boundary definition, interface design, and practical file structure generation. Do NOT use for general Terraform coding with no module boundary, provider version upgrades (use terraform-provider-upgrade skill), or non-Terraform IaC.
Install
npx vskill@latest install thomast1906/github-copilot-agent-skills/terraform-module-creatorSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as thomast1906/github-copilot-agent-skills/terraform-module-creator.
Terraform Module Creator
Purpose
Use this skill to help design and create Terraform modules from real infrastructure requirements.
This skill is intended to do more than generate Terraform files. It should help decide whether a module is justified in the first place, define a clear module responsibility, shape a clean interface, and avoid over-engineering.
The goal is to produce Terraform modules that are understandable, maintainable, and genuinely useful in practice.
Prerequisites
The following tools must be installed locally before using this skill. The skill references them during generation and validation steps.
| Tool | Purpose | Install | |
|---|---|---|---|
| Terraform | Core IaC tool — init, validate, fmt | brew install hashicorp/tap/terraform | |
| terraform-docs | Generates README inputs/outputs from module source | brew install terraform-docs | |
| tflint | Static analysis — catches deprecated args, provider-specific issues | brew install tflint | |
| tflint-ruleset-azurerm | Azure-specific tflint rules | configured via .tflint.hcl (see VALIDATION.md) |
Minimum versions: Terraform ≥ 1.2 (required for lifecycle preconditions/postconditions). terraform-docs ≥ 0.16. tflint ≥ 0.50.
If any tool is missing, the skill will flag this and suggest the install command before running validation steps.
Required MCP Tools
This skill makes active use of the HashiCorp Terraform Registry MCP and the Azure MCP Server. Use the tools below at the indicated stages of the workflow. Full parameter reference and example call sequences are in references/MCP-TOOLS.md.
| Tool | Stage | Purpose | |
|---|---|---|---|
azure-azureterraformbestpractices | Step 1 — Understand the ask | Get Azure Terraform best practices before starting design | |
azure-get_azure_bestpractices | Step 1 — Understand the ask | Get platform-level best practices for the specific Azure service | |
azure-documentation | Step 1 — Understand the ask | Look up CAF naming standards, DNS zone names, service feature behaviour | |
azure-wellarchitectedframework | Step 1 / Step 6 | Get WAF pillar recommendations to inform secure, reliable defaults | |
mcp_terraform_search_modules | Step 2 — Decide module type | Check if an Azure Verified Module or registry module already exists | |
mcp_terraform_get_module_details | Step 2 — Decide module type | Review an existing module's inputs/outputs to assess fit | |
mcp_terraform_get_provider_capabilities | Step 3 — Define boundary | Discover what azurerm resources exist for the service area | |
mcp_terraform_search_providers | Step 4 — Design interface | Find provider resource documentation by service slug | |
mcp_terraform_get_provider_details | Step 4 — Design interface | Get full argument reference and attribute reference for a resource | |
mcp_terraform_get_latest_provider_version | Step 6 — Generate module | Get the current latest azurerm version for versions.tf |
Important: Before invoking any Azure MCP tool, run a discovery call with learn=true or tool_search_tool_regex to confirm the exact tool name. Do not hardcode names that may change.
When to Use
- a user wants to create a new Terraform module from a requirement or scenario
- a repeated Terraform pattern may need to become a shared module
- a team wants help shaping module inputs, outputs, and scope
- a platform team wants to define a reusable Terraform pattern without unnecessary abstraction
- reviewing whether plain Terraform resources would be better than introducing a new module
- creating Azure-focused Terraform modules that need to align with platform standards and operational expectations
Core principles
Always optimise for the following:
- KISS — Keep the module easy to understand, easy to consume, and easy to support.
- DRY with judgement — Reduce meaningful duplication, but do not chase abstraction for its own sake.
- Clear responsibility — A module should solve one coherent problem well.
- Practical reuse — Build modules for real repeated demand, not hypothetical future scenarios.
- Readable interfaces — Variables, outputs, defaults, and naming should be obvious and predictable.
- Operational supportability — A team should be able to understand what the module does and how to use it without fighting through unnecessary complexity.
- Safe and sensible defaults — Be opinionated where it reduces toil and inconsistency, but do not hide critical behaviour.
Approach
Follow this process for every request.
1. Understand the ask
Call azure-azureterraformbestpractices and azure-get_azure_bestpractices for the target Azure service before starting design. Call azure-documentation for CAF naming conventions, private endpoint DNS zone names, or any service feature behaviour that needs current guidance. Call azure-wellarchitectedframework to understand which WAF pillar recommendations should inform the module's default values. This grounds decisions in current Azure platform guidance rather than assumptions.
Identify:
- what is being deployed
- what problem the module is solving
- who will consume the module
- whether this is platform-level reuse or a local implementation detail
- whether the requirement is stable enough to justify a shared module
Where useful, restate the module intent in one sentence before generating anything.
Example:
This module is intended to provision a standard Azure Storage Account pattern with consistent naming, tagging, diagnostics, and access configuration for shared platform use.
2. Decide the module type
Check the Terraform Registry for reference. Call mcp_terraform_search_modules to see what existing modules look like for the resource. Use this to understand common interface patterns and what other teams have found necessary — not to replace the custom module. AVM and registry modules are often over-abstracted and do not align with the KISS principle this skill applies. Review them for ideas, not as a recommendation to adopt.
If a candidate is found, call mcp_terraform_get_module_details to review its interface. Use this to identify what arguments matter in practice and what complexity to avoid.
Work out whether the module is:
- a building block module — a focused reusable unit for a specific infrastructure component
- a composition module — a higher-level module that combines several related resources into a usable pattern
Prefer building block modules unless a composition module clearly maps to a repeated platform pattern. Do not create composition modules that bundle unrelated concerns together.
3. Define the module boundary
State clearly:
- what the module owns
- what it expects from consumers
- what should remain outside the module
- what dependencies should be passed in rather than created internally
- what operational assumptions the module is making
A good module boundary should be easy to explain in a few lines.
4. Design the interface
Use mcp_terraform_search_providers to find the resource documentation by service slug, then call mcp_terraform_get_provider_details with the returned provider_doc_id to get the full argument reference. Use this to understand all available arguments before deciding which to expose as variables. See references/MCP-TOOLS.md for common service slug values.
Design variables and outputs with discipline.
Variables
- include only what consumers genuinely need to set
- prefer clear, explicit names
- group related inputs logically
- use defaults where the behaviour is predictable and safe
- avoid exposing every possible provider option
- avoid optional inputs that massively change module behaviour
- avoid large sets of loosely related switches
- add
validation {}blocks to enum-style variables (SKU, tier, kind) and name format constraints — catch bad inputs at plan time with a clear error message, not a cryptic provider error
Outputs
- return only values that consumers are likely to use
- keep outputs meaningful and predictable
- avoid outputting everything just because it is available
- mark
sensitive = trueon any output containing a secret: connection strings, access keys, passwords, SAS tokens - prefer outputting
principal_id(managed identity) over connection strings — guide consumers toward keyless authentication
Locals
- use locals to improve readability and consistency
- do not hide important logic unnecessarily
5. Recommend a file structure
Start simple. A typical module structure:
Add locals.tf if it improves clarity. Only add more files if there is a clear readability benefit. Do not create file sprawl for the sake of neatness.
Always create an examples/basic/ folder alongside the module. Each example is a standalone, independently runnable Terraform root module — it needs its own main.tf (the module call), variables.tf, outputs.tf, versions.tf, and README.md. The main.tf should demonstrate minimum viable usage with hardcoded values; keep variables.tf minimal and only expose what a caller genuinely needs to parameterise (e.g., resource group name, location). For modules with distinct usage patterns (e.g., with and without private endpoint), add a second subfolder such as examples/private-endpoint/ with the same full file set.
Always include .terraform-docs.yml — the README inputs and outputs table is generated by terraform-docs, not written by hand. The README contains a static description and usage example written by the author, with <!-- BEGIN_TF_DOCS --> / <!-- END_TF_DOCS --> markers where terraform-docs injects the generated content.
6. Generate the module
Before generating versions.tf, call mcp_terraform_get_latest_provider_version(namespace="hashicorp", name="azurerm") to get the current latest version and use it as the minimum constraint.
For modules with dependent optional variables (e.g., private_endpoint.enabled = true requires subnet_id), add lifecycle { precondition {} } blocks on the resource to surface misconfigurations clearly before any resource is created. See MODULE-PATTERNS.md for the pattern.
When generating code:
- prefer readable Terraform over clever Terraform
- keep resource declarations easy to follow
- use naming and tagging patterns consistently
- reflect platform standards where relevant
- include diagnostics, identity, or governance-related configuration where it is part of the intended pattern
- avoid deep conditional complexity unless it is truly necessary
Always generate the following alongside the Terraform files:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/terraform-module-creator/SKILL.md
Popularity
- Repository stars
- 189
- Repository forks
- 53
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 14 Jul 2026, 4 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/thomast1906/github-copilot-agent-skills/terraform-module-creator)