AgentSkillsCN

Terraform Module Discovery

Terraform 模块发现

SKILL.md

Terraform Module Discovery Skill

This skill provides Terraform module discovery capabilities for GitHub-hosted Terraform module repositories.

Usage

Use the terraform-module-discovery.js script to discover and get information about available Terraform modules.

List All Modules

To list all available Terraform modules in a repository:

bash
node .github/skills/terraform-module-discovery/terraform-module-discovery.js <repo-url> list

Example:

bash
node .github/skills/terraform-module-discovery/terraform-module-discovery.js https://github.com/Philcartmell/terraform-modules list

Search for Modules

To search for modules by name pattern:

bash
node .github/skills/terraform-module-discovery/terraform-module-discovery.js <repo-url> search <pattern>

Example:

bash
node .github/skills/terraform-module-discovery/terraform-module-discovery.js https://github.com/Philcartmell/terraform-modules search keyvault

Get a Specific Module

To get detailed information about a specific module by exact name:

bash
node .github/skills/terraform-module-discovery/terraform-module-discovery.js <repo-url> get <module-name>

Example:

bash
node .github/skills/terraform-module-discovery/terraform-module-discovery.js https://github.com/Philcartmell/terraform-modules get azure-keyvault

Output

The script outputs JSON with the following structure for each module:

json
{
  "name": "module-name",
  "path": "path/in/repo",
  "description": "Module description from terraform-docs.json",
  "source": "git::https://github.com/Philcartmell/terraform-modules//path",
  "variables": [
    {
      "name": "variable_name",
      "type": "string",
      "description": "Variable description",
      "default": "default_value",
      "required": true
    }
  ],
  "outputs": [
    {
      "name": "output_name",
      "description": "Output description"
    }
  ],
  "files": ["main.tf", "variables.tf", "outputs.tf"]
}

Authentication

The script automatically attempts to use a GitHub token for API authentication to avoid rate limits:

  1. First checks the GITHUB_TOKEN environment variable
  2. Falls back to gh auth token from the GitHub CLI if authenticated

When to Use This Skill

  • When you need to discover available Terraform modules in the centralized repository
  • When composing Terraform configurations and need to find the right module
  • When you need to understand a module's variables and outputs before using it
  • When searching for modules that match a specific pattern or technology