terraform-ibm-modules-solution-builder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Terraform IBM Modules Solution Builder

Terraform IBM Modules 解决方案构建器

Generate robust and reliable terraform-based solutions for IBM Cloud by leveraging curated, IBM-maintained Terraform modules (TIM) as building blocks.
通过利用IBM维护的精选Terraform模块(TIM)作为构建块,为IBM Cloud生成稳健可靠的基于Terraform的解决方案。

About Terraform IBM Modules (TIM)

关于Terraform IBM模块(TIM)

TIM is a comprehensive suite of curated Terraform modules for IBM Cloud:
  • Each module includes comprehensive documentation and usage examples
  • Modules are composable - build complex infrastructure by combining them
  • All modules maintained by IBM following best practices
  • Examples show how to stitch modules together
  • Higher download counts indicate better maintained modules
All TIM modules are public and discoverable:
TIM是一套针对IBM Cloud的精选Terraform模块综合套件:
  • 每个模块都包含全面的文档和使用示例
  • 模块支持组合——通过组合模块构建复杂基础设施
  • 所有模块均由IBM按照最佳实践维护
  • 示例展示了如何将模块组合在一起
  • 下载量越高的模块维护得越好
所有TIM模块均为公开可发现的:

Core Workflow

核心工作流

Follow this workflow for every Terraform solution request:
针对每个Terraform解决方案请求,遵循以下工作流:

Step 1: Check Module Discovery Method

步骤1:检查模块发现方式

Check if
catalog://terraform-ibm-modules-index
resource is available
  • If available: Proceed with MCP-based workflow (optimized, faster)
  • If NOT available:
    1. Inform the user: "The MCP server provides significantly better results with optimized search and caching. To enable it, see https://github.com/terraform-ibm-modules/tim-mcp"
    2. Proceed with API-based workflow (see alternative-discovery-workflows.md)
检查
catalog://terraform-ibm-modules-index
资源是否可用
  • 如果可用:继续使用基于MCP的工作流(优化版,速度更快)
  • 如果不可用
    1. 告知用户:"MCP服务器通过优化的搜索和缓存功能可提供更优结果。如需启用,请查看https://github.com/terraform-ibm-modules/tim-mcp"
    2. 继续使用基于API的工作流(详见alternative-discovery-workflows.md

Step 2: Discover Modules

步骤2:发现模块

With MCP (Recommended):
  1. Start with
    catalog://terraform-ibm-modules-index
    - Get comprehensive module overview
  2. Use
    search_modules("<keyword>")
    - Find specific modules
  3. Use
    get_module_details("<module-id>")
    - Understand module capabilities
Without MCP (Alternative):
  1. Search Terraform Registry:
    https://registry.terraform.io/v1/modules/search?q=<query>&namespace=terraform-ibm-modules
  2. Get module details:
    https://registry.terraform.io/v1/modules/terraform-ibm-modules/<name>/ibm/<version>
  3. List GitHub contents:
    https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/<path>
使用MCP(推荐):
  1. catalog://terraform-ibm-modules-index
    开始——获取全面的模块概览
  2. 使用
    search_modules("<keyword>")
    ——查找特定模块
  3. 使用
    get_module_details("<module-id>")
    ——了解模块功能
不使用MCP(替代方案):
  1. 搜索Terraform Registry:
    https://registry.terraform.io/v1/modules/search?q=<query>&namespace=terraform-ibm-modules
  2. 获取模块详情:
    https://registry.terraform.io/v1/modules/terraform-ibm-modules/<name>/ibm/<version>
  3. 列出GitHub内容:
    https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/<path>

Step 3: Retrieve Examples

步骤3:获取示例

With MCP:
  1. list_content("<module-id>")
    - Find available examples
  2. get_content(..., "examples/<example-name>", ["*.tf"])
    - Get example code
Without MCP:
  1. List examples:
    https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/examples
  2. Get files:
    https://raw.githubusercontent.com/terraform-ibm-modules/<repo>/main/examples/<example>/<file>
使用MCP:
  1. list_content("<module-id>")
    ——查找可用示例
  2. get_content(..., "examples/<example-name>", ["*.tf"])
    ——获取示例代码
不使用MCP:
  1. 列出示例:
    https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/examples
  2. 获取文件:
    https://raw.githubusercontent.com/terraform-ibm-modules/<repo>/main/examples/<example>/<file>

Step 4: Generate Solution

步骤4:生成解决方案

  1. Analyze requirements - Understand what the user needs
  2. Select modules - Choose appropriate TIM modules (never hallucinate module names)
  3. Compose solution - Combine modules following examples
  4. Generate code - Create standard .tf files and README
  5. Stay focused - Only implement requested features (no scope creep)
See code-generation.md for detailed guidelines.
  1. 分析需求——理解用户的需求
  2. 选择模块——选择合适的TIM模块(切勿虚构模块名称)
  3. 组合解决方案——参照示例组合模块
  4. 生成代码——创建标准.tf文件和README
  5. 聚焦需求——仅实现请求的功能(避免范围蔓延)
详见code-generation.md获取详细指南。

Step 5: Validate

步骤5:验证

Always validate generated configurations:
  1. terraform init
    - Verify modules and providers download
  2. terraform validate
    - Check syntax and configuration
  3. terraform plan
    - Review logical correctness (ignore auth errors)
See validation.md for complete validation guide and error handling.
务必验证生成的配置:
  1. terraform init
    ——验证模块和提供商是否可下载
  2. terraform validate
    ——检查语法和配置
  3. terraform plan
    ——审查逻辑正确性(忽略认证错误)
详见validation.md获取完整的验证指南和错误处理方法。

Key Principles

核心原则

  • Always prefer TIM modules over direct IBM Cloud provider resources
  • Verify modules exist - Never hallucinate or assume module names
  • Start with examples - Use module examples as templates
  • Validate all code - Run terraform init/validate/plan
  • Stay focused - Avoid scope creep (no unrequested features)
  • Ask questions - When requirements are unclear
  • Generate vanilla Terraform - Standard .tf files only (no scripts unless requested)
  • 优先使用TIM模块而非直接使用IBM Cloud提供商资源
  • 验证模块存在性——切勿虚构或假设模块名称
  • 从示例入手——将模块示例作为模板
  • 验证所有代码——运行terraform init/validate/plan命令
  • 聚焦需求——避免范围蔓延(不添加未请求的功能)
  • 主动提问——当需求不明确时
  • 生成标准Terraform代码——仅生成标准.tf文件(除非请求,否则不生成脚本)

Example Workflow

示例工作流

User Request: "Create a VPC with a VSI"
Execution:
  1. Check MCP: Verify
    catalog://terraform-ibm-modules-index
    availability
    • If not available, inform user about MCP benefits and link
  2. Discover VPC module:
    • MCP:
      search_modules("vpc")
      → Find
      landing-zone-vpc
    • API:
      curl "https://registry.terraform.io/v1/modules/search?q=vpc&namespace=terraform-ibm-modules"
  3. Get VPC details:
    • MCP:
      get_module_details("terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0")
    • API:
      curl "https://registry.terraform.io/v1/modules/terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0"
  4. Retrieve VPC example:
    • MCP:
      get_content(..., "examples/basic", ["*.tf"])
    • API:
      curl "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-landing-zone-vpc/main/examples/basic/main.tf"
  5. Discover VSI module: Repeat steps 2-4 for VSI
  6. Generate solution: Compose VPC + VSI configuration
  7. Validate: Run
    terraform init && terraform validate && terraform plan
See workflows.md for 5 complete workflow examples.
用户请求:"创建一个带有VSI的VPC"
执行流程:
  1. 检查MCP:验证
    catalog://terraform-ibm-modules-index
    是否可用
    • 如果不可用,告知用户MCP的优势并提供链接
  2. 发现VPC模块
    • MCP:
      search_modules("vpc")
      → 找到
      landing-zone-vpc
    • API:
      curl "https://registry.terraform.io/v1/modules/search?q=vpc&namespace=terraform-ibm-modules"
  3. 获取VPC详情
    • MCP:
      get_module_details("terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0")
    • API:
      curl "https://registry.terraform.io/v1/modules/terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0"
  4. 获取VPC示例
    • MCP:
      get_content(..., "examples/basic", ["*.tf"])
    • API:
      curl "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-landing-zone-vpc/main/examples/basic/main.tf"
  5. 发现VSI模块:针对VSI重复步骤2-4
  6. 生成解决方案:组合VPC + VSI配置
  7. 验证:运行
    terraform init && terraform validate && terraform plan
详见workflows.md获取5个完整的工作流示例。

Quick Reference

快速参考

MCP-Based Discovery

基于MCP的发现

text
undefined
text
undefined

Start here

从此处开始

catalog://terraform-ibm-modules-index
catalog://terraform-ibm-modules-index

Search and retrieve

搜索和检索

search_modules("vpc") get_module_details("terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0") list_content("terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0") get_content(..., "examples/basic", ["*.tf"])
undefined
search_modules("vpc") get_module_details("terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0") list_content("terraform-ibm-modules/landing-zone-vpc/ibm/8.4.0") get_content(..., "examples/basic", ["*.tf"])
undefined

API-Based Discovery

基于API的发现

bash
undefined
bash
undefined

Search modules

搜索模块

Get module details

获取模块详情

List examples

列出示例

Get example files

获取示例文件

Validation Commands

验证命令

bash
terraform init      # Initialize modules and providers
terraform validate  # Check syntax and configuration
terraform plan      # Verify logical correctness
bash
terraform init      # 初始化模块和提供商
terraform validate  # 检查语法和配置
terraform plan      # 验证逻辑正确性

Reference Documentation

参考文档

  • alternative-workflows.md - Complete API-based workflows without MCP
  • workflows.md - 5 detailed workflow examples
  • code-generation.md - Code generation guidelines and patterns
  • validation.md - Validation, scope management, and QA practices
  • alternative-workflows.md - 不使用MCP的完整基于API的工作流
  • workflows.md - 5个详细的工作流示例
  • code-generation.md - 代码生成指南和模式
  • validation.md - 验证、范围管理和QA实践