terraform-ibm-modules-solution-builder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTerraform 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:
- Terraform Registry: https://registry.terraform.io/namespaces/terraform-ibm-modules
- GitHub Organization: https://github.com/terraform-ibm-modules
TIM是一套针对IBM Cloud的精选Terraform模块综合套件:
- 每个模块都包含全面的文档和使用示例
- 模块支持组合——通过组合模块构建复杂基础设施
- 所有模块均由IBM按照最佳实践维护
- 示例展示了如何将模块组合在一起
- 下载量越高的模块维护得越好
所有TIM模块均为公开可发现的:
- Terraform Registry: https://registry.terraform.io/namespaces/terraform-ibm-modules
- GitHub Organization: https://github.com/terraform-ibm-modules
Core Workflow
核心工作流
Follow this workflow for every Terraform solution request:
针对每个Terraform解决方案请求,遵循以下工作流:
Step 1: Check Module Discovery Method
步骤1:检查模块发现方式
Check if resource is available
catalog://terraform-ibm-modules-index- If available: Proceed with MCP-based workflow (optimized, faster)
- If NOT available:
- 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"
- Proceed with API-based workflow (see alternative-discovery-workflows.md)
检查资源是否可用
catalog://terraform-ibm-modules-index- 如果可用:继续使用基于MCP的工作流(优化版,速度更快)
- 如果不可用:
- 告知用户:"MCP服务器通过优化的搜索和缓存功能可提供更优结果。如需启用,请查看https://github.com/terraform-ibm-modules/tim-mcp"
- 继续使用基于API的工作流(详见alternative-discovery-workflows.md)
Step 2: Discover Modules
步骤2:发现模块
With MCP (Recommended):
- Start with - Get comprehensive module overview
catalog://terraform-ibm-modules-index - Use - Find specific modules
search_modules("<keyword>") - Use - Understand module capabilities
get_module_details("<module-id>")
Without MCP (Alternative):
- Search Terraform Registry:
https://registry.terraform.io/v1/modules/search?q=<query>&namespace=terraform-ibm-modules - Get module details:
https://registry.terraform.io/v1/modules/terraform-ibm-modules/<name>/ibm/<version> - List GitHub contents:
https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/<path>
使用MCP(推荐):
- 从开始——获取全面的模块概览
catalog://terraform-ibm-modules-index - 使用——查找特定模块
search_modules("<keyword>") - 使用——了解模块功能
get_module_details("<module-id>")
不使用MCP(替代方案):
- 搜索Terraform Registry:
https://registry.terraform.io/v1/modules/search?q=<query>&namespace=terraform-ibm-modules - 获取模块详情:
https://registry.terraform.io/v1/modules/terraform-ibm-modules/<name>/ibm/<version> - 列出GitHub内容:
https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/<path>
Step 3: Retrieve Examples
步骤3:获取示例
With MCP:
- - Find available examples
list_content("<module-id>") - - Get example code
get_content(..., "examples/<example-name>", ["*.tf"])
Without MCP:
- List examples:
https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/examples - Get files:
https://raw.githubusercontent.com/terraform-ibm-modules/<repo>/main/examples/<example>/<file>
使用MCP:
- ——查找可用示例
list_content("<module-id>") - ——获取示例代码
get_content(..., "examples/<example-name>", ["*.tf"])
不使用MCP:
- 列出示例:
https://api.github.com/repos/terraform-ibm-modules/<repo>/contents/examples - 获取文件:
https://raw.githubusercontent.com/terraform-ibm-modules/<repo>/main/examples/<example>/<file>
Step 4: Generate Solution
步骤4:生成解决方案
- Analyze requirements - Understand what the user needs
- Select modules - Choose appropriate TIM modules (never hallucinate module names)
- Compose solution - Combine modules following examples
- Generate code - Create standard .tf files and README
- Stay focused - Only implement requested features (no scope creep)
See code-generation.md for detailed guidelines.
- 分析需求——理解用户的需求
- 选择模块——选择合适的TIM模块(切勿虚构模块名称)
- 组合解决方案——参照示例组合模块
- 生成代码——创建标准.tf文件和README
- 聚焦需求——仅实现请求的功能(避免范围蔓延)
详见code-generation.md获取详细指南。
Step 5: Validate
步骤5:验证
Always validate generated configurations:
- - Verify modules and providers download
terraform init - - Check syntax and configuration
terraform validate - - Review logical correctness (ignore auth errors)
terraform plan
See validation.md for complete validation guide and error handling.
务必验证生成的配置:
- ——验证模块和提供商是否可下载
terraform init - ——检查语法和配置
terraform validate - ——审查逻辑正确性(忽略认证错误)
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:
- Check MCP: Verify availability
catalog://terraform-ibm-modules-index- If not available, inform user about MCP benefits and link
- Discover VPC module:
- MCP: → Find
search_modules("vpc")landing-zone-vpc - API:
curl "https://registry.terraform.io/v1/modules/search?q=vpc&namespace=terraform-ibm-modules"
- MCP:
- 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"
- MCP:
- 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"
- MCP:
- Discover VSI module: Repeat steps 2-4 for VSI
- Generate solution: Compose VPC + VSI configuration
- Validate: Run
terraform init && terraform validate && terraform plan
See workflows.md for 5 complete workflow examples.
用户请求:"创建一个带有VSI的VPC"
执行流程:
- 检查MCP:验证是否可用
catalog://terraform-ibm-modules-index- 如果不可用,告知用户MCP的优势并提供链接
- 发现VPC模块:
- MCP:→ 找到
search_modules("vpc")landing-zone-vpc - API:
curl "https://registry.terraform.io/v1/modules/search?q=vpc&namespace=terraform-ibm-modules"
- MCP:
- 获取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"
- MCP:
- 获取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"
- MCP:
- 发现VSI模块:针对VSI重复步骤2-4
- 生成解决方案:组合VPC + VSI配置
- 验证:运行
terraform init && terraform validate && terraform plan
详见workflows.md获取5个完整的工作流示例。
Quick Reference
快速参考
MCP-Based Discovery
基于MCP的发现
text
undefinedtext
undefinedStart 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"])
undefinedsearch_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"])
undefinedAPI-Based Discovery
基于API的发现
bash
undefinedbash
undefinedSearch modules
搜索模块
Get module details
获取模块详情
List examples
列出示例
Get example files
获取示例文件
undefinedValidation Commands
验证命令
bash
terraform init # Initialize modules and providers
terraform validate # Check syntax and configuration
terraform plan # Verify logical correctnessbash
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实践