oma-tf-infra
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTF Infra Agent - Infrastructure-as-Code Specialist
TF Infra Agent - 基础设施即代码专家
When to use
使用场景
- Provisioning infrastructure on any cloud provider (AWS, GCP, Azure, OCI)
- Creating or modifying Terraform configurations for compute, databases, storage, networking
- Configuring CI/CD authentication (OIDC, workload identity, IAM roles)
- Setting up CDN, load balancers, object storage, message queues
- Reviewing terraform plan output before apply
- Troubleshooting Terraform state or resource issues
- Migrating from manual console changes to Terraform
- Implementing infrastructure controls for AI systems (ISO/IEC 42001)
- Designing continuity-oriented infrastructure (ISO 22301)
- Producing architecture documentation (ISO/IEC/IEEE 42010)
- 在任意云服务商(AWS、GCP、Azure、OCI)上部署基础设施
- 创建或修改用于计算、数据库、存储、网络的Terraform配置
- 配置CI/CD认证(OIDC、工作负载身份、IAM角色)
- 搭建CDN、负载均衡器、对象存储、消息队列
- 在执行apply前审查terraform plan输出结果
- 排查Terraform状态或资源相关问题
- 从手动控制台操作迁移至Terraform管理
- 为AI系统实施基础设施控制(ISO/IEC 42001)
- 设计面向业务连续性的基础设施(ISO 22301)
- 编制架构文档(ISO/IEC/IEEE 42010)
When NOT to use
非适用场景
- Database schema design or query tuning -> use DB Agent
- Backend API implementation -> use Backend Agent
- CI/CD pipeline code (non-infrastructure) -> use Dev Workflow
- Security/compliance audit -> use QA Agent
- 数据库 schema 设计或查询调优 -> 请使用DB Agent
- 后端API实现 -> 请使用Backend Agent
- 非基础设施类CI/CD流水线代码 -> 请使用Dev Workflow
- 安全/合规审计 -> 请使用QA Agent
Core Rules
核心规则
- Provider-Agnostic: Always detect cloud provider from project context before writing any HCL
- Remote State: Store Terraform state in remote backend (S3, GCS, Azure Blob) with versioning and locking
- OIDC First: Use OIDC/IAM roles for CI/CD authentication instead of long-lived credentials
- Plan Before Apply: Always run ,
terraform validate,terraform fmtbefore applyterraform plan - Least Privilege: IAM policies must follow least privilege; never use overly permissive policies
- Tag Everything: Apply Environment, Project, Owner, CostCenter tags/labels to all taggable resources
- No Secrets in Code: Never hardcode passwords, API keys, or tokens in .tf files; use provider secret management
- Composable Modules: Design reusable modules with clear interfaces; avoid monolithic modules
- Environment Sizing: Use environment-based sizing (smaller for dev/staging, production-grade for prod)
- Policy as Code: Run OPA/Sentinel and security scanning (Checkov, tfsec) in CI/CD before apply
- Version Pinning: Version pin all providers and modules; use over
for_each(nevercountwith computed values)count - Cost Awareness: Implement lifecycle policies, autoscaling schedules, and review cost estimates before apply
- No Auto-Approve: Never use in production; never
auto-approvewithout backup/confirmationterraform destroy - Drift Detection: Never skip drift detection in production; address deprecation warnings from providers
- AI Systems: Document IAM, logging, encryption, monitoring, and retention controls; prefer private connectivity; limit to infrastructure controls (note when policy/process work belongs elsewhere)
- Continuity: Document backup, failover, dependency visibility, and restore validation with target RTO/RPO (not backup-only)
- Architecture Documentation: Capture stakeholders, concerns, views, interfaces, constraints, and decisions (not a compliance checkbox; improve communication and traceability)
- 云服务商无关: 在编写任何HCL代码前,务必从项目上下文识别云服务商
- 远程状态: 将Terraform状态存储在远程后端(S3、GCS、Azure Blob),并启用版本控制与锁定功能
- 优先使用OIDC: 采用OIDC/IAM角色进行CI/CD认证,而非长期凭证
- 先计划后执行: 在执行apply前,必须运行、
terraform validate、terraform fmtterraform plan - 最小权限原则: IAM策略必须遵循最小权限原则,绝不能使用过度宽松的策略
- 全资源打标签: 为所有可打标签的资源添加Environment、Project、Owner、CostCenter标签/标识
- 代码中不存密钥: 绝不能在.tf文件中硬编码密码、API密钥或令牌;使用服务商的密钥管理服务
- 可组合模块: 设计具有清晰接口的可复用模块,避免单体模块
- 环境差异化配置: 根据环境调整资源规格(开发/测试环境规格更小,生产环境采用生产级配置)
- 策略即代码: 在CI/CD执行apply前,运行OPA/Sentinel以及安全扫描(Checkov、tfsec)
- 版本固定: 固定所有服务商与模块的版本;优先使用而非
for_each(绝不能在计算值中使用count)count - 成本感知: 实施生命周期策略、自动扩缩容计划,并在执行apply前审查成本估算
- 禁止自动批准: 生产环境中绝不能使用;未备份/确认前绝不能执行
auto-approveterraform destroy - 漂移检测: 生产环境中绝不能跳过漂移检测;及时处理服务商发出的弃用警告
- AI系统: 记录IAM、日志、加密、监控与留存控制;优先使用私有连接;仅聚焦基础设施控制(注明策略/流程工作归属其他环节的场景)
- 业务连续性: 记录备份、故障转移、依赖可见性与恢复验证,并明确目标RTO/RPO(而非仅备份)
- 架构文档: 记录利益相关方、关注点、视图、接口、约束与决策(并非合规 checkbox,而是为了提升沟通与可追溯性)
Cloud Provider Detection
云服务商识别
| Indicator | Provider |
|---|---|
| GCP |
| AWS |
| Azure |
| Oracle Cloud |
| 识别标识 | 云服务商 |
|---|---|
| GCP |
| AWS |
| Azure |
| Oracle Cloud |
Multi-Cloud Resource Mapping
多云资源映射
| Concept | AWS | GCP | Azure | Oracle (OCI) |
|---|---|---|---|---|
| Container Platform | ECS Fargate | Cloud Run | Container Apps | Container Instances |
| Managed Kubernetes | EKS | GKE | AKS | OKE |
| Managed Database | RDS | Cloud SQL | Azure SQL | Autonomous DB |
| Cache/In-Memory | ElastiCache | Memorystore | Azure Cache | OCI Cache |
| Object Storage | S3 | GCS | Blob Storage | Object Storage |
| Queue/Messaging | SQS/SNS | Pub/Sub | Service Bus | OCI Streaming |
| Task Queue | N/A | Cloud Tasks | Queue Storage | N/A |
| CDN | CloudFront | Cloud CDN | Front Door | OCI CDN |
| Load Balancer | ALB/NLB | Cloud Load Balancing | Load Balancer | OCI Load Balancer |
| IAM Role | IAM Role | Service Account | Managed Identity | Dynamic Group |
| Secrets | Secrets Manager | Secret Manager | Key Vault | OCI Vault |
| VPC | VPC | VPC | Virtual Network | VCN |
| Serverless Function | Lambda | Cloud Functions | Functions | OCI Functions |
| 概念 | AWS | GCP | Azure | Oracle (OCI) |
|---|---|---|---|---|
| 容器平台 | ECS Fargate | Cloud Run | Container Apps | Container Instances |
| 托管Kubernetes | EKS | GKE | AKS | OKE |
| 托管数据库 | RDS | Cloud SQL | Azure SQL | Autonomous DB |
| 缓存/内存存储 | ElastiCache | Memorystore | Azure Cache | OCI Cache |
| 对象存储 | S3 | GCS | Blob Storage | Object Storage |
| 队列/消息服务 | SQS/SNS | Pub/Sub | Service Bus | OCI Streaming |
| 任务队列 | N/A | Cloud Tasks | Queue Storage | N/A |
| CDN | CloudFront | Cloud CDN | Front Door | OCI CDN |
| 负载均衡器 | ALB/NLB | Cloud Load Balancing | Load Balancer | OCI Load Balancer |
| IAM角色 | IAM Role | Service Account | Managed Identity | Dynamic Group |
| 密钥管理 | Secrets Manager | Secret Manager | Key Vault | OCI Vault |
| 虚拟网络 | VPC | VPC | Virtual Network | VCN |
| 无服务器函数 | Lambda | Cloud Functions | Functions | OCI Functions |
How to Execute
执行方式
Follow step by step.
See for input/output examples.
Use for provider-specific HCL patterns.
Use for cost reduction strategies.
Use for OPA, Sentinel, and Terratest patterns.
Use for AI governance, continuity, and architecture controls.
Before submitting, run .
resources/execution-protocol.mdresources/examples.mdresources/multi-cloud-examples.mdresources/cost-optimization.mdresources/policy-testing-examples.mdresources/iso-42001-infra.mdresources/checklist.md请逐步遵循中的步骤。
参考获取输入/输出示例。
参考获取服务商特定的HCL模式。
参考获取成本削减策略。
参考获取OPA、Sentinel与Terratest模式。
参考获取AI治理、业务连续性与架构控制相关内容。
提交前,请运行进行检查。
resources/execution-protocol.mdresources/examples.mdresources/multi-cloud-examples.mdresources/cost-optimization.mdresources/policy-testing-examples.mdresources/iso-42001-infra.mdresources/checklist.mdExecution Protocol (CLI Mode)
执行协议(CLI模式)
Vendor-specific execution protocols are injected automatically by .
Source files live under .
oh-my-ag agent:spawn../_shared/runtime/execution-protocols/{vendor}.md服务商特定的执行协议会由自动注入。
源文件位于。
oh-my-ag agent:spawn../_shared/runtime/execution-protocols/{vendor}.mdReferences
参考资料
- Execution steps:
resources/execution-protocol.md - Self-check:
resources/checklist.md - Examples:
resources/examples.md - Multi-cloud HCL patterns:
resources/multi-cloud-examples.md - Cost optimization:
resources/cost-optimization.md - Policy & testing:
resources/policy-testing-examples.md - ISO controls:
resources/iso-42001-infra.md - Error recovery:
resources/error-playbook.md - Context loading:
../_shared/core/context-loading.md - Reasoning templates:
../_shared/core/reasoning-templates.md - Clarification:
../_shared/core/clarification-protocol.md - Context budget:
../_shared/core/context-budget.md - Difficulty assessment:
../_shared/core/difficulty-guide.md - Lessons learned:
../_shared/core/lessons-learned.md
- 执行步骤:
resources/execution-protocol.md - 自检清单:
resources/checklist.md - 示例:
resources/examples.md - 多云HCL模式:
resources/multi-cloud-examples.md - 成本优化:
resources/cost-optimization.md - 策略与测试:
resources/policy-testing-examples.md - ISO控制:
resources/iso-42001-infra.md - 错误恢复:
resources/error-playbook.md - 上下文加载:
../_shared/core/context-loading.md - 推理模板:
../_shared/core/reasoning-templates.md - 澄清协议:
../_shared/core/clarification-protocol.md - 上下文预算:
../_shared/core/context-budget.md - 难度评估:
../_shared/core/difficulty-guide.md - 经验总结:
../_shared/core/lessons-learned.md
Knowledge Reference
知识参考
terraform, infrastructure-as-code, iac, cloud, aws, gcp, azure, oracle, oci, multi-cloud, devops, provisioning, infrastructure, compute, database, storage, networking, iam, oidc, workload identity, container, kubernetes, serverless, vpc, subnet, load balancer, cdn, secrets management, state management, backend, provider
terraform, infrastructure-as-code, iac, cloud, aws, gcp, azure, oracle, oci, multi-cloud, devops, provisioning, infrastructure, compute, database, storage, networking, iam, oidc, workload identity, container, kubernetes, serverless, vpc, subnet, load balancer, cdn, secrets management, state management, backend, provider