Infra Sync 标志

Infra Sync

组织
agentic-community
infra-sync

确保 Terraform 和 CDK 基础设施保持同步。比较 terraform/aws-ecs/ 和 infra/,找出 ECS 服务、网络、存储、密钥、IAM 和配置方面的差异。报告一致性缺口,并为目标 IaC 工具生成修复方案。Terraform 或 CDK 基础设施发生更改时使用。

Add to TypingMind

概览

发布者agentic-community
代码仓库mcp-gateway-registry
技能名称infra-sync
星标数
969
复刻数
244
附带文件
仅含指令
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 agentic-community 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Infra Sync AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/agentic-community/mcp-gateway-registry/tree/main/.claude/skills/infra-sync
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/agentic-community/mcp-gateway-registry.git /tmp/mcp-gateway-registry
mkdir -p .claude/skills
cp -r /tmp/mcp-gateway-registry/.claude/skills/infra-sync .claude/skills/infra-sync
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Infra Sync,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Infra Sync。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Infra Sync 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Infrastructure Sync Skill

Use this skill when changes are made to either the Terraform (terraform/aws-ecs/) or CDK (infra/) infrastructure and the other needs to be updated to maintain parity.

When to Use

  • After modifying Terraform files in terraform/aws-ecs/
  • After modifying CDK files in infra/lib/registry/
  • When asked to check if Terraform and CDK are in sync
  • Before deploying to verify both IaC tools produce equivalent infrastructure

Input Modes

  1. Full Sync Check - Compare all resources across both IaC tools
  2. Targeted Sync - Compare a specific area (e.g., "sync ECS services" or "sync networking")
  3. Propagate Change - User made changes to one tool and wants the other updated

Workflow

Step 1: Identify the Source of Truth

Ask the user (or determine from context):

  • Which IaC tool was just modified? (Terraform or CDK)
  • Is this a full sync check or targeted to a specific area?

Step 2: Read Both Configurations

Read the relevant files from both Terraform and CDK based on the comparison area.

File Mapping (Terraform to CDK)
Comparison AreaTerraform FilesCDK Files
ECS Servicesterraform/aws-ecs/modules/mcp-gateway/ecs-services.tfinfra/lib/registry/registry-service-stack.ts
Networkingterraform/aws-ecs/modules/mcp-gateway/networking.tf, terraform/aws-ecs/vpc.tfinfra/lib/registry/registry-network-stack.ts, infra/lib/registry/registry-service-stack.ts (ALB section)
Storage (EFS)terraform/aws-ecs/modules/mcp-gateway/storage.tfinfra/lib/registry/registry-service-stack.ts (EFS section)
Storage (DocumentDB)terraform/aws-ecs/documentdb.tfinfra/lib/registry/registry-data-stack.ts, infra/lib/registry/constructs/documentdb-cluster.ts
Secretsterraform/aws-ecs/modules/mcp-gateway/secrets.tfinfra/lib/registry/registry-service-stack.ts (secrets section)
IAMterraform/aws-ecs/modules/mcp-gateway/iam.tfinfra/lib/registry/constructs/registry-ecs-service.ts (task roles)
Keycloakterraform/aws-ecs/keycloak-ecs.tf, terraform/aws-ecs/keycloak-*.tfinfra/lib/registry/registry-auth-stack.ts, infra/lib/registry/constructs/keycloak-service.ts
Observabilityterraform/aws-ecs/modules/mcp-gateway/observability.tfinfra/lib/registry/constructs/observability-pipeline.ts
CloudFront/WAFterraform/aws-ecs/cloudfront.tf, terraform/aws-ecs/waf.tfinfra/lib/registry/registry-cdn-stack.ts, infra/lib/registry/constructs/cloudfront-distribution.ts, infra/lib/registry/constructs/waf-rules.ts
Secret Rotationterraform/aws-ecs/secret-rotation.tfinfra/lib/registry/registry-ops-stack.ts, infra/lib/registry/constructs/secret-rotation.ts
CI/CDterraform/aws-ecs/codebuild.tfinfra/lib/registry/registry-build-stack.ts, infra/lib/registry/constructs/codebuild-pipeline.ts
Variables/Configterraform/aws-ecs/variables.tf, terraform/aws-ecs/modules/mcp-gateway/variables.tfinfra/lib/registry/registry-config.ts, infra/config.yaml
Monitoringterraform/aws-ecs/cloudwatch-alarms.tf, terraform/aws-ecs/modules/mcp-gateway/monitoring.tfinfra/lib/registry/registry-service-stack.ts (monitoring section)

Step 3: Compare Resource by Resource

For each comparison area, check the following attributes:

ECS Services Comparison Checklist

For each service (registry, auth-server, MCP servers, A2A agents):

  • Container image - Same ECR repository and tag
  • CPU/Memory - Same task definition resources
  • Port mappings - Same container ports
  • Environment variables - Same env vars passed to container
    • Check every env var key and value source
    • Flag any env var present in one but not the other
  • Secrets - Same Secrets Manager references
    • Check JSON key extraction syntax (:username::, :password::)
  • EFS mounts - Same volume mounts (or both empty)
  • Health check - Same endpoint, interval, timeout
  • Service Connect - Same discovery name and port
  • Auto-scaling - Same min/max/target values
  • Circuit breaker - Document if only in one (CDK has it, Terraform may not)
  • Replicas - Same desired count
Networking Comparison Checklist
  • VPC - Same CIDR, AZ count, subnet layout
  • ALB - Same scheme, listeners, target groups
  • Security groups - Same ingress/egress rules
  • Service Discovery - Same namespace name, service names
  • VPC Endpoints - Same endpoint types
Storage Comparison Checklist
  • EFS access points - Same paths, POSIX user/group, permissions
  • EFS mount targets - Same subnet placement
  • DocumentDB - Same engine, instance class, encryption, auth
  • Aurora MySQL - Same engine, scaling, encryption
Secrets Comparison Checklist
  • Secret names - Same set of secrets created
  • KMS encryption - Same key configuration
  • Conditional creation - Same conditions for optional secrets
  • Rotation - Same rotation schedule and Lambda config

Step 4: Generate Parity Report

Present findings in this format:

markdown
## Infrastructure Parity Report

**Date:** {date}
**Source of Truth:** {Terraform|CDK}
**Scope:** {Full|Targeted area}

### Summary

| Area | Status | Discrepancies |
|------|--------|---------------|
| ECS Services | {In Sync / Diverged} | {count} |
| Networking | {In Sync / Diverged} | {count} |
| Storage | {In Sync / Diverged} | {count} |
| Secrets | {In Sync / Diverged} | {count} |
| IAM | {In Sync / Diverged} | {count} |
| Observability | {In Sync / Diverged} | {count} |

### Discrepancies

#### {Area}: {Description}

| Attribute | Terraform | CDK | Action Required |
|-----------|-----------|-----|-----------------|
| {attr} | {tf value} | {cdk value} | {Fix in TF / Fix in CDK / Intentional} |

### Intentional Differences

These differences are by design and should NOT be synced:

| Feature | CDK | Terraform | Rationale |
|---------|-----|-----------|-----------|
| Circuit Breaker | Enabled | Not configured | Faster failure detection (~4 min vs ~3 hours) |
| HOME=/tmp | Set on registry | Not set | Fixes Path.home() PermissionError in container |
| DocumentDB credentials | Always passed when cluster exists | Gated on storage_backend | Skills repository always uses DocumentDB |
| Keycloak URL fallback | Falls back to http://{alb-dns} | Always https:// | Deployment without Route53/certs |

### Recommendations

1. **Must Fix:** {Critical parity gaps}
2. **Should Fix:** {Important but non-breaking gaps}
3. **Consider:** {Nice-to-have improvements}

Step 5: Apply Fixes

If the user wants fixes applied:

  1. Determine the target (Terraform or CDK)
  2. Make the edits to bring the target in sync
  3. For CDK changes: run cd infra && npx tsc --noEmit to verify TypeScript compiles
  4. For Terraform changes: run cd terraform/aws-ecs && terraform validate if available
  5. Present a summary of all changes made

Comparison Details by Area

ECS Services - Environment Variables Deep Comparison

This is the most common source of drift. For each ECS service, extract and compare every environment variable:

Terraform location: Look for environment = [{ name = "...", value = "..." }] blocks in ecs-services.tf

CDK location: Look for environment: { KEY: "value" } objects in registry-service-stack.ts

Compare line by line. Pay special attention to:

  • Variables that reference other resources (ALB DNS, Keycloak URL, DocumentDB endpoint)
  • Variables with conditional logic (only set when a feature is enabled)
  • Variables that use Secrets Manager references vs plain environment variables

ECS Services - Secrets Deep Comparison

Terraform: Look for secrets = [{ name = "...", valueFrom = "..." }] blocks CDK: Look for secrets: { KEY: ecs.Secret.fromSecretsManager(...) } objects

Compare the JSON key extraction syntax carefully:

  • Terraform: "${aws_secretsmanager_secret.x.arn}:username::"
  • CDK: ecs.Secret.fromSecretsManager(secret, 'username')

EFS Mounts Deep Comparison

Terraform: Check mount_points and volume blocks in each service definition CDK: Check efsVolumes property in RegistryEcsService constructor calls

Important: The registry service should have NO EFS mounts in both tools. Only auth-server and specific MCP servers mount EFS.

ALB Listeners and Target Groups

Terraform: Check aws_lb_listener and aws_lb_target_group resources in networking.tf CDK: Check listener and target group creation in registry-service-stack.ts

Compare:

  • Listener ports and protocols
  • Target group health check paths, intervals, and thresholds
  • Deregistration delay
  • Stickiness settings

Known Intentional Differences

Maintain this list of differences that should NOT trigger sync warnings:

  1. Circuit Breaker - CDK enables circuitBreaker: { enable: true, rollback: true } on ECS services. Terraform does not. This is intentional for faster failure detection.

  2. HOME=/tmp - CDK sets HOME=/tmp on the registry container. Terraform does not. This fixes a Path.home() PermissionError that occurs when the container runs as a non-root user without a home directory.

  3. DocumentDB Credential Passing - CDK passes DocumentDB credentials whenever dataStack.documentDbSecretArn exists. Terraform gates on var.storage_backend == "documentdb". CDK's approach is correct because the skills repository always uses DocumentDB regardless of the storage backend setting.

  4. Keycloak URL Fallback - CDK falls back to http://{alb-dns-name} when Route53 is disabled. Terraform always uses https://. CDK's approach allows deployment without DNS/certificates.

Tips

  • When comparing environment variables, sort them alphabetically for easier visual comparison
  • Use grep -n "ENV_VAR_NAME" to quickly find where a variable is defined in both codebases
  • After making changes to CDK, always run cd infra && npx tsc --noEmit to verify compilation
  • After making changes to Terraform, run terraform fmt and terraform validate
  • Check infra/docs/CDK-INFRASTRUCTURE.md for the latest CDK documentation and parity notes

常见问题

Infra Sync AI 技能有什么作用?

确保 Terraform 和 CDK 基础设施保持同步。比较 terraform/aws-ecs/ 和 infra/,找出 ECS 服务、网络、存储、密钥、IAM 和配置方面的差异。报告一致性缺口,并为目标 IaC 工具生成修复方案。Terraform 或 CDK 基础设施发生更改时使用。

为什么在 TypingMind 中使用 Infra Sync?

因为您只需安装一次,就能搭配任何模型使用。Infra Sync 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Infra Sync?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/agentic-community/mcp-gateway-registry/tree/main/.claude/skills/infra-sync。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Infra Sync?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Infra Sync 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Infra Sync 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Infra Sync AI 技能免费吗?

是的。agentic-community 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇