Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:20:06 +08:00
commit 168a87fd60
9 changed files with 266 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
{
"name": "terraform-module-builder",
"description": "Build reusable Terraform modules",
"version": "1.0.0",
"author": {
"name": "Claude Code Plugins",
"email": "[email protected]"
},
"skills": [
"./skills"
],
"commands": [
"./commands"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# terraform-module-builder
Build reusable Terraform modules

View File

@@ -0,0 +1,25 @@
---
description: $(echo "$description" | cut -d' ' -f1-5)
---
# $(echo "$name" | sed 's/-/ /g' | sed 's/\b\(.\)/\u\1/g')
$(echo "$description")
## Key Features
- Production-ready configurations
- Best practices implementation
- Security-first approach
- Scalable architecture
- Comprehensive documentation
- Multi-platform support
## Example Usage
This plugin generates complete configurations for your DevOps needs.
Specify your requirements and get production-ready code instantly.
## When Invoked
Generate configurations and setup code based on your specific requirements and infrastructure needs.

65
plugin.lock.json Normal file
View File

@@ -0,0 +1,65 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/devops/terraform-module-builder",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "1aa2e93d237cf51237bc01ad0d0d1dcfb03821a5",
"treeHash": "4f3b18bfdd6d5a6412ce10fb477fc320cbf5e8089f7602fff8100a0fd86e63a0",
"generatedAt": "2025-11-28T10:18:48.584857Z",
"toolVersion": "publish_plugins.py@0.2.0"
},
"origin": {
"remote": "git@github.com:zhongweili/42plugin-data.git",
"branch": "master",
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
},
"manifest": {
"name": "terraform-module-builder",
"description": "Build reusable Terraform modules",
"version": "1.0.0"
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "d274a82b06d38997d1ce2d3700300a4dc900d6c7be26d4582d8142f9048f74bb"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "f140a189a7fbbb35633d0367ce8392ebf915e7765d3124636f5affb3a0228ff7"
},
{
"path": "commands/terraform-module.md",
"sha256": "353f80054a90cda1e6716da3628115ce829307fbbb83a15b64f1d37c96224a99"
},
{
"path": "skills/terraform-module-builder/SKILL.md",
"sha256": "ffa75e6fc20bb4e548fc4af9b0c70cca1b42fdf952fe71394909f05c7539ee9d"
},
{
"path": "skills/terraform-module-builder/references/README.md",
"sha256": "8ae37a673f66c61353f60adfd3c5e003f2d6a6662d3a307c51b0548ae42f69b0"
},
{
"path": "skills/terraform-module-builder/scripts/README.md",
"sha256": "d4af34f37038e0196041633605f19102a01283f14c376f5cd4813807664c659a"
},
{
"path": "skills/terraform-module-builder/assets/validation_rules.json",
"sha256": "5026a35a578b2a2a53afa8aacba7d345f8c2c980b8d40c354cc9b50c3491757b"
},
{
"path": "skills/terraform-module-builder/assets/README.md",
"sha256": "5fc75348aa56acbdcd71204634874a354c68f950e7430db42c194a18f98f0d81"
}
],
"dirSha256": "4f3b18bfdd6d5a6412ce10fb477fc320cbf5e8089f7602fff8100a0fd86e63a0"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}

View File

@@ -0,0 +1,52 @@
---
name: building-terraform-modules
description: |
This skill empowers Claude to build reusable Terraform modules based on user specifications. It leverages the terraform-module-builder plugin to generate production-ready, well-documented Terraform module code, incorporating best practices for security, scalability, and multi-platform support. Use this skill when the user requests to create a new Terraform module, generate Terraform configuration, or needs help structuring infrastructure as code using Terraform. The trigger terms include "create Terraform module," "generate Terraform configuration," "Terraform module code," and "infrastructure as code."
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
version: 1.0.0
---
## Overview
This skill allows Claude to efficiently generate Terraform modules, streamlining infrastructure-as-code development. By utilizing the terraform-module-builder plugin, it ensures modules are production-ready, well-documented, and incorporate best practices.
## How It Works
1. **Receiving User Request**: Claude receives a request to create a Terraform module, including details about the module's purpose and desired features.
2. **Generating Module Structure**: Claude invokes the terraform-module-builder plugin to create the basic file structure and configuration files for the module.
3. **Customizing Module Content**: Claude uses the user's specifications to populate the module with variables, outputs, and resource definitions, ensuring best practices are followed.
## When to Use This Skill
This skill activates when you need to:
- Create a new Terraform module from scratch.
- Generate production-ready Terraform configuration files.
- Implement infrastructure as code using Terraform modules.
## Examples
### Example 1: Creating a VPC Module
User request: "Create a Terraform module for a VPC with public and private subnets, a NAT gateway, and appropriate security groups."
The skill will:
1. Invoke the terraform-module-builder plugin to generate a basic VPC module structure.
2. Populate the module with Terraform code to define the VPC, subnets, NAT gateway, and security groups based on best practices.
### Example 2: Generating an S3 Bucket Module
User request: "Generate a Terraform module for an S3 bucket with versioning enabled, encryption at rest, and a lifecycle policy for deleting objects after 30 days."
The skill will:
1. Invoke the terraform-module-builder plugin to create a basic S3 bucket module structure.
2. Populate the module with Terraform code to define the S3 bucket with the requested features (versioning, encryption, lifecycle policy).
## Best Practices
- **Documentation**: Ensure the generated Terraform module includes comprehensive documentation, explaining the module's purpose, inputs, and outputs.
- **Security**: Implement security best practices, such as using least privilege principles and encrypting sensitive data.
- **Modularity**: Design the Terraform module to be reusable and configurable, allowing it to be easily adapted to different environments.
## Integration
This skill integrates seamlessly with other Claude Code plugins by providing a foundation for infrastructure provisioning. The generated Terraform modules can be used by other plugins to deploy and manage resources in various cloud environments.

View File

@@ -0,0 +1,7 @@
# Assets
Bundled resources for terraform-module-builder skill
- [ ] module_template/: A directory containing template files for different types of Terraform modules (e.g., web server, database).
- [ ] example_modules/: A directory containing example Terraform modules that users can use as a starting point.
- [ ] validation_rules.json: A JSON file containing the rules used by the validation_checks.py script to validate the Terraform module code.

View File

@@ -0,0 +1,83 @@
{
"_comment": "Validation rules for Terraform modules. Each rule is a key, and the value is an object containing the regex, severity, and description.",
"naming_convention_variables": {
"regex": "^[a-z][a-z0-9_]*$",
"severity": "error",
"description": "Variable names should be lowercase, start with a letter, and contain only letters, numbers, and underscores."
},
"naming_convention_outputs": {
"regex": "^[a-z][a-z0-9_]*$",
"severity": "error",
"description": "Output names should be lowercase, start with a letter, and contain only letters, numbers, and underscores."
},
"naming_convention_resources": {
"regex": "^[a-z][a-z0-9_]*$",
"severity": "warning",
"description": "Resource names should be lowercase, start with a letter, and contain only letters, numbers, and underscores."
},
"variable_description_required": {
"regex": "(description\\s*=\\s*\"[^\"]+\")",
"severity": "error",
"description": "All variables must have a description."
},
"output_description_required": {
"regex": "(description\\s*=\\s*\"[^\"]+\")",
"severity": "error",
"description": "All outputs must have a description."
},
"variable_type_required": {
"regex": "(type\\s*=\\s*(string|number|bool|list|map|object|set)\\(.*\\))",
"severity": "error",
"description": "All variables must have a type defined."
},
"no_sensitive_data_in_defaults": {
"regex": "default\\s*=\\s*(\"[A-Za-z0-9+/=]{20,}\"|\\d{16})",
"severity": "warning",
"description": "Avoid storing sensitive data like passwords or API keys in variable defaults. Consider using input variables or secrets management instead."
},
"consistent_resource_naming": {
"regex": "resource\\s+\"[a-zA-Z]+\"\\s+\"([a-z0-9_]+)\"\\s+\"([a-z0-9_]+)\"",
"severity": "info",
"description": "Ensure resource names are consistently named within the module (e.g., using a prefix)."
},
"provider_version_pinning": {
"regex": "required_providers\\s*=\\s*\\{\\s*[a-z]+\\s*=\\s*\\{\\s*source\\s*=\\s*\"[a-z0-9/]+\"\\s*version\\s*=\\s*\"~>\\s*\\d+\\.\\d+\"",
"severity": "warning",
"description": "Pin provider versions to avoid unexpected changes. Use the '~>' operator for minor version updates."
},
"no_http_data_sources": {
"regex": "(data\\s*\"http\")",
"severity": "warning",
"description": "Avoid using http data sources directly; they are less secure and harder to manage. Consider alternatives."
},
"no_local_exec": {
"regex": "(provisioner\\s*\"local-exec\")",
"severity": "warning",
"description": "Avoid using the local-exec provisioner; it makes modules less portable and harder to debug. Consider alternatives."
},
"required_files_present": {
"files": ["variables.tf", "outputs.tf", "main.tf", "README.md"],
"severity": "error",
"description": "Ensure the module contains the required files: variables.tf, outputs.tf, main.tf, and README.md."
},
"readme_contains_example": {
"regex": "(## Example)",
"severity": "warning",
"description": "README.md should contain an Example section."
},
"readme_contains_inputs": {
"regex": "(## Inputs)",
"severity": "warning",
"description": "README.md should contain an Inputs section."
},
"readme_contains_outputs": {
"regex": "(## Outputs)",
"severity": "warning",
"description": "README.md should contain an Outputs section."
},
"naming_convention_modules": {
"regex": "^[a-z][a-z0-9_]*$",
"severity": "warning",
"description": "Module names should be lowercase, start with a letter, and contain only letters, numbers, and underscores."
}
}

View File

@@ -0,0 +1,9 @@
# References
Bundled resources for terraform-module-builder skill
- [ ] terraform_best_practices.md: A comprehensive guide to Terraform best practices, covering topics such as security, scalability, and maintainability.
- [ ] aws_resource_examples.md: Examples of how to use common AWS resources in Terraform modules, with explanations and best practices.
- [ ] azure_resource_examples.md: Examples of how to use common Azure resources in Terraform modules, with explanations and best practices.
- [ ] gcp_resource_examples.md: Examples of how to use common GCP resources in Terraform modules, with explanations and best practices.
- [ ] module_structure_guide.md: A detailed guide on how to structure a Terraform module for reusability and maintainability.

View File

@@ -0,0 +1,7 @@
# Scripts
Bundled resources for terraform-module-builder skill
- [ ] module_scaffolding.py: Generates the basic file structure and initial code for a new Terraform module based on user-defined inputs.
- [ ] validation_checks.py: Performs automated checks on the generated Terraform module code to ensure it adheres to best practices and security guidelines.
- [ ] documentation_generator.py: Automatically generates documentation for the Terraform module based on the code and user-provided descriptions.