Logo Infra Sync

Infra Sync

Tổ chức
agentic-community
infra-sync

Keep Terraform and CDK infrastructure in sync. Compares terraform/aws-ecs/ and infra/ to identify discrepancies in ECS services, networking, storage, secrets, IAM, and configuration. Reports parity gaps and generates fixes for the target IaC tool. Use when changes are made to either Terraform or CDK infrastructure.

Tổng quan

Nhà phát hànhagentic-community
Kho mãmcp-gateway-registry
Tên kỹ nănginfra-sync
Sao
969
Bản fork
244
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được agentic-community công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Infra Sync trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/agentic-community/mcp-gateway-registry/tree/main/.claude/skills/infra-sync
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Infra Sync trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Infra Sync ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Infra Sync với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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

Câu hỏi thường gặp

Kỹ năng AI Infra Sync làm được gì?

Keep Terraform and CDK infrastructure in sync. Compares terraform/aws-ecs/ and infra/ to identify discrepancies in ECS services, networking, storage, secrets, IAM, and configuration. Reports parity gaps and generates fixes for the target IaC tool. Use when changes are made to either Terraform or CDK infrastructure.

Vì sao nên dùng Infra Sync trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Infra Sync là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Infra Sync trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/agentic-community/mcp-gateway-registry/tree/main/.claude/skills/infra-sync. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Infra Sync?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Infra Sync với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Infra Sync với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Infra Sync có miễn phí không?

Có. Kỹ năng này được agentic-community phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇