specweave 0.18.1 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +229 -1817
- package/README.md +68 -0
- package/bin/specweave.js +62 -6
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +3 -0
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
- package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts +21 -0
- package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts.map +1 -0
- package/dist/plugins/specweave/lib/hooks/update-ac-status.js +162 -0
- package/dist/plugins/specweave/lib/hooks/update-ac-status.js.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js +65 -6
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/completion-calculator.d.ts +112 -0
- package/dist/plugins/specweave-github/lib/completion-calculator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/completion-calculator.js +301 -0
- package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +3 -3
- package/dist/plugins/specweave-github/lib/duplicate-detector.js +3 -3
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +7 -0
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/epic-content-builder.js +42 -0
- package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +14 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.js +51 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.js +1 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +87 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.js +412 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +64 -13
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts +78 -0
- package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/progress-comment-builder.js +237 -0
- package/dist/plugins/specweave-github/lib/progress-comment-builder.js.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts +97 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.js +301 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.js.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts +83 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +386 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts +8 -6
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js +78 -117
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js.map +1 -1
- package/dist/src/cli/commands/import-docs.js +4 -4
- package/dist/src/cli/commands/import-docs.js.map +1 -1
- package/dist/src/cli/commands/init-multiproject.d.ts.map +1 -1
- package/dist/src/cli/commands/init-multiproject.js +17 -18
- package/dist/src/cli/commands/init-multiproject.js.map +1 -1
- package/dist/src/cli/commands/migrate-to-multiproject.d.ts.map +1 -1
- package/dist/src/cli/commands/migrate-to-multiproject.js +8 -4
- package/dist/src/cli/commands/migrate-to-multiproject.js.map +1 -1
- package/dist/src/cli/commands/switch-project.d.ts.map +1 -1
- package/dist/src/cli/commands/switch-project.js +9 -26
- package/dist/src/cli/commands/switch-project.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-content.js +3 -0
- package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
- package/dist/src/core/deduplication/command-deduplicator.d.ts +166 -0
- package/dist/src/core/deduplication/command-deduplicator.d.ts.map +1 -0
- package/dist/src/core/deduplication/command-deduplicator.js +254 -0
- package/dist/src/core/deduplication/command-deduplicator.js.map +1 -0
- package/dist/src/core/increment/active-increment-manager.d.ts +42 -15
- package/dist/src/core/increment/active-increment-manager.d.ts.map +1 -1
- package/dist/src/core/increment/active-increment-manager.js +113 -46
- package/dist/src/core/increment/active-increment-manager.js.map +1 -1
- package/dist/src/core/increment/conflict-resolver.d.ts +40 -0
- package/dist/src/core/increment/conflict-resolver.d.ts.map +1 -0
- package/dist/src/core/increment/conflict-resolver.js +219 -0
- package/dist/src/core/increment/conflict-resolver.js.map +1 -0
- package/dist/src/core/increment/discipline-checker.d.ts.map +1 -1
- package/dist/src/core/increment/discipline-checker.js +7 -1
- package/dist/src/core/increment/discipline-checker.js.map +1 -1
- package/dist/src/core/increment/duplicate-detector.d.ts +52 -0
- package/dist/src/core/increment/duplicate-detector.d.ts.map +1 -0
- package/dist/src/core/increment/duplicate-detector.js +276 -0
- package/dist/src/core/increment/duplicate-detector.js.map +1 -0
- package/dist/src/core/increment/increment-archiver.d.ts +90 -0
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -0
- package/dist/src/core/increment/increment-archiver.js +368 -0
- package/dist/src/core/increment/increment-archiver.js.map +1 -0
- package/dist/src/core/increment/increment-reopener.d.ts +165 -0
- package/dist/src/core/increment/increment-reopener.d.ts.map +1 -0
- package/dist/src/core/increment/increment-reopener.js +390 -0
- package/dist/src/core/increment/increment-reopener.js.map +1 -0
- package/dist/src/core/increment/metadata-manager.d.ts +26 -1
- package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
- package/dist/src/core/increment/metadata-manager.js +143 -5
- package/dist/src/core/increment/metadata-manager.js.map +1 -1
- package/dist/src/core/increment/recent-work-scanner.d.ts +121 -0
- package/dist/src/core/increment/recent-work-scanner.d.ts.map +1 -0
- package/dist/src/core/increment/recent-work-scanner.js +303 -0
- package/dist/src/core/increment/recent-work-scanner.js.map +1 -0
- package/dist/src/core/increment/types.d.ts +1 -0
- package/dist/src/core/increment/types.d.ts.map +1 -1
- package/dist/src/core/increment-utils.d.ts +112 -0
- package/dist/src/core/increment-utils.d.ts.map +1 -0
- package/dist/src/core/increment-utils.js +210 -0
- package/dist/src/core/increment-utils.js.map +1 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.d.ts +65 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.d.ts.map +1 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.js +175 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.js.map +1 -0
- package/dist/src/core/living-docs/feature-archiver.d.ts +130 -0
- package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -0
- package/dist/src/core/living-docs/feature-archiver.js +549 -0
- package/dist/src/core/living-docs/feature-archiver.js.map +1 -0
- package/dist/src/core/living-docs/feature-id-manager.d.ts +81 -0
- package/dist/src/core/living-docs/feature-id-manager.d.ts.map +1 -0
- package/dist/src/core/living-docs/feature-id-manager.js +339 -0
- package/dist/src/core/living-docs/feature-id-manager.js.map +1 -0
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts +144 -83
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -1
- package/dist/src/core/living-docs/hierarchy-mapper.js +488 -270
- package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
- package/dist/src/core/living-docs/index.d.ts +6 -0
- package/dist/src/core/living-docs/index.d.ts.map +1 -1
- package/dist/src/core/living-docs/index.js +6 -0
- package/dist/src/core/living-docs/index.js.map +1 -1
- package/dist/src/core/living-docs/project-detector.d.ts +6 -0
- package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
- package/dist/src/core/living-docs/project-detector.js +35 -1
- package/dist/src/core/living-docs/project-detector.js.map +1 -1
- package/dist/src/core/living-docs/spec-distributor.d.ts +100 -26
- package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -1
- package/dist/src/core/living-docs/spec-distributor.js +1275 -258
- package/dist/src/core/living-docs/spec-distributor.js.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts +109 -0
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -0
- package/dist/src/core/living-docs/task-project-specific-generator.js +221 -0
- package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -0
- package/dist/src/core/living-docs/types.d.ts +143 -0
- package/dist/src/core/living-docs/types.d.ts.map +1 -1
- package/dist/src/core/project-manager.d.ts +2 -17
- package/dist/src/core/project-manager.d.ts.map +1 -1
- package/dist/src/core/project-manager.js +68 -48
- package/dist/src/core/project-manager.js.map +1 -1
- package/dist/src/core/spec-content-sync.d.ts +1 -1
- package/dist/src/core/spec-content-sync.d.ts.map +1 -1
- package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -1
- package/dist/src/core/sync/enhanced-content-builder.js +2 -1
- package/dist/src/core/sync/enhanced-content-builder.js.map +1 -1
- package/dist/src/core/sync/performance-optimizer.d.ts +153 -0
- package/dist/src/core/sync/performance-optimizer.d.ts.map +1 -0
- package/dist/src/core/sync/performance-optimizer.js +220 -0
- package/dist/src/core/sync/performance-optimizer.js.map +1 -0
- package/dist/src/core/sync/retry-handler.d.ts +98 -0
- package/dist/src/core/sync/retry-handler.d.ts.map +1 -0
- package/dist/src/core/sync/retry-handler.js +196 -0
- package/dist/src/core/sync/retry-handler.js.map +1 -0
- package/dist/src/core/types/config.d.ts +94 -0
- package/dist/src/core/types/config.d.ts.map +1 -1
- package/dist/src/core/types/config.js +16 -0
- package/dist/src/core/types/config.js.map +1 -1
- package/dist/src/core/types/increment-metadata.d.ts +6 -0
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/dist/src/core/types/increment-metadata.js +10 -1
- package/dist/src/core/types/increment-metadata.js.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.js +4 -8
- package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.js +4 -8
- package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/COMMANDS.md +13 -4
- package/plugins/specweave/commands/specweave-abandon.md +22 -20
- package/plugins/specweave/commands/specweave-archive-features.md +121 -0
- package/plugins/specweave/commands/specweave-archive-increments.md +82 -0
- package/plugins/specweave/commands/specweave-archive.md +363 -0
- package/plugins/specweave/commands/specweave-backlog.md +211 -0
- package/plugins/specweave/commands/specweave-fix-duplicates.md +517 -0
- package/plugins/specweave/commands/specweave-increment.md +4 -3
- package/plugins/specweave/commands/specweave-progress.md +176 -27
- package/plugins/specweave/commands/specweave-reopen.md +391 -0
- package/plugins/specweave/commands/specweave-restore-feature.md +90 -0
- package/plugins/specweave/commands/specweave-restore.md +309 -0
- package/plugins/specweave/commands/specweave-resume.md +51 -23
- package/plugins/specweave/commands/specweave-status.md +41 -7
- package/plugins/specweave/commands/specweave-sync-specs.md +425 -0
- package/plugins/specweave/hooks/hooks.json +4 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
- package/plugins/specweave/hooks/post-task-completion.sh +39 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh +83 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
- package/plugins/specweave/lib/hooks/sync-living-docs.js +2 -0
- package/plugins/specweave/lib/hooks/sync-living-docs.ts +4 -0
- package/plugins/specweave/lib/hooks/update-ac-status.js +102 -0
- package/plugins/specweave/lib/hooks/update-ac-status.ts +192 -0
- package/plugins/specweave/skills/archive-increments/SKILL.md +198 -0
- package/plugins/specweave/skills/increment-planner/scripts/feature-utils.js +14 -0
- package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +244 -0
- package/plugins/specweave-ado/lib/ado-spec-content-sync.js +49 -5
- package/plugins/specweave-ado/lib/ado-spec-content-sync.ts +72 -6
- package/plugins/specweave-confluent/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-confluent/README.md +375 -0
- package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +306 -0
- package/plugins/specweave-confluent/skills/confluent-kafka-connect/SKILL.md +453 -0
- package/plugins/specweave-confluent/skills/confluent-ksqldb/SKILL.md +470 -0
- package/plugins/specweave-confluent/skills/confluent-schema-registry/SKILL.md +316 -0
- package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +2 -2
- package/plugins/specweave-github/agents/user-story-updater/AGENT.md +148 -0
- package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +1 -1
- package/plugins/specweave-github/commands/specweave-github-update-user-story.md +156 -0
- package/plugins/specweave-github/hooks/post-task-completion.sh +10 -9
- package/plugins/specweave-github/lib/completion-calculator.js +262 -0
- package/plugins/specweave-github/lib/completion-calculator.ts +434 -0
- package/plugins/specweave-github/lib/duplicate-detector.js +3 -3
- package/plugins/specweave-github/lib/duplicate-detector.ts +4 -4
- package/plugins/specweave-github/lib/epic-content-builder.js +38 -0
- package/plugins/specweave-github/lib/epic-content-builder.ts +59 -0
- package/plugins/specweave-github/lib/github-client-v2.js +49 -0
- package/plugins/specweave-github/lib/github-client-v2.ts +59 -0
- package/plugins/specweave-github/lib/github-epic-sync.ts +1 -1
- package/plugins/specweave-github/lib/github-feature-sync.js +381 -0
- package/plugins/specweave-github/lib/github-feature-sync.ts +568 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.js +40 -10
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +82 -14
- package/plugins/specweave-github/lib/progress-comment-builder.js +229 -0
- package/plugins/specweave-github/lib/progress-comment-builder.ts +324 -0
- package/plugins/specweave-github/lib/user-story-content-builder.js +299 -0
- package/plugins/specweave-github/lib/user-story-content-builder.ts +413 -0
- package/plugins/specweave-github/lib/user-story-issue-builder.js +344 -0
- package/plugins/specweave-github/lib/user-story-issue-builder.ts +543 -0
- package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +189 -0
- package/plugins/{specweave-ado/lib/enhanced-ado-sync.js → specweave-jira/lib/enhanced-jira-sync.js} +25 -61
- package/plugins/specweave-jira/lib/{enhanced-jira-sync.ts.disabled → enhanced-jira-sync.ts} +26 -52
- package/plugins/specweave-kafka/.claude-plugin/plugin.json +26 -0
- package/plugins/specweave-kafka/IMPLEMENTATION-COMPLETE.md +483 -0
- package/plugins/specweave-kafka/README.md +242 -0
- package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +235 -0
- package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +209 -0
- package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +266 -0
- package/plugins/specweave-kafka/commands/deploy.md +99 -0
- package/plugins/specweave-kafka/commands/dev-env.md +176 -0
- package/plugins/specweave-kafka/commands/mcp-configure.md +101 -0
- package/plugins/specweave-kafka/commands/monitor-setup.md +96 -0
- package/plugins/specweave-kafka/docker/kafka-local/docker-compose.yml +187 -0
- package/plugins/specweave-kafka/docker/redpanda/docker-compose.yml +199 -0
- package/plugins/specweave-kafka/docker/templates/consumer-nodejs.js +225 -0
- package/plugins/specweave-kafka/docker/templates/consumer-python.py +220 -0
- package/plugins/specweave-kafka/docker/templates/producer-nodejs.js +168 -0
- package/plugins/specweave-kafka/docker/templates/producer-python.py +167 -0
- package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.js +438 -0
- package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.ts +541 -0
- package/plugins/specweave-kafka/lib/adapters/platform-adapter.js +47 -0
- package/plugins/specweave-kafka/lib/adapters/platform-adapter.ts +343 -0
- package/plugins/specweave-kafka/lib/cli/kcat-wrapper.js +258 -0
- package/plugins/specweave-kafka/lib/cli/kcat-wrapper.ts +298 -0
- package/plugins/specweave-kafka/lib/cli/types.js +10 -0
- package/plugins/specweave-kafka/lib/cli/types.ts +92 -0
- package/plugins/specweave-kafka/lib/connectors/connector-catalog.js +305 -0
- package/plugins/specweave-kafka/lib/connectors/connector-catalog.ts +528 -0
- package/plugins/specweave-kafka/lib/documentation/diagram-generator.js +114 -0
- package/plugins/specweave-kafka/lib/documentation/diagram-generator.ts +195 -0
- package/plugins/specweave-kafka/lib/documentation/exporter.js +210 -0
- package/plugins/specweave-kafka/lib/documentation/exporter.ts +338 -0
- package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.js +60 -0
- package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.ts +130 -0
- package/plugins/specweave-kafka/lib/documentation/topology-generator.js +143 -0
- package/plugins/specweave-kafka/lib/documentation/topology-generator.ts +290 -0
- package/plugins/specweave-kafka/lib/mcp/detector.js +298 -0
- package/plugins/specweave-kafka/lib/mcp/detector.ts +352 -0
- package/plugins/specweave-kafka/lib/mcp/types.js +21 -0
- package/plugins/specweave-kafka/lib/mcp/types.ts +77 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.js +193 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.ts +362 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.js +188 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.ts +359 -0
- package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.js +195 -0
- package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.ts +380 -0
- package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.js +209 -0
- package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.ts +358 -0
- package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.js +354 -0
- package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.ts +563 -0
- package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.js +259 -0
- package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.ts +516 -0
- package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.js +233 -0
- package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.ts +423 -0
- package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.js +266 -0
- package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.ts +445 -0
- package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.js +312 -0
- package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.ts +561 -0
- package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.js +289 -0
- package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.ts +607 -0
- package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.js +264 -0
- package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.ts +498 -0
- package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.js +263 -0
- package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.ts +549 -0
- package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.js +205 -0
- package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.ts +399 -0
- package/plugins/specweave-kafka/lib/performance/performance-optimizer.js +249 -0
- package/plugins/specweave-kafka/lib/performance/performance-optimizer.ts +427 -0
- package/plugins/specweave-kafka/lib/security/kafka-security.js +252 -0
- package/plugins/specweave-kafka/lib/security/kafka-security.ts +494 -0
- package/plugins/specweave-kafka/lib/utils/capacity-planner.js +203 -0
- package/plugins/specweave-kafka/lib/utils/capacity-planner.ts +469 -0
- package/plugins/specweave-kafka/lib/utils/config-validator.js +419 -0
- package/plugins/specweave-kafka/lib/utils/config-validator.ts +564 -0
- package/plugins/specweave-kafka/lib/utils/partitioning.js +329 -0
- package/plugins/specweave-kafka/lib/utils/partitioning.ts +473 -0
- package/plugins/specweave-kafka/lib/utils/sizing.js +221 -0
- package/plugins/specweave-kafka/lib/utils/sizing.ts +374 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-broker-metrics.json +628 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-cluster-overview.json +564 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-consumer-lag.json +509 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-jvm-metrics.json +674 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-topic-metrics.json +578 -0
- package/plugins/specweave-kafka/monitoring/grafana/provisioning/dashboards/kafka.yml +17 -0
- package/plugins/specweave-kafka/monitoring/grafana/provisioning/datasources/prometheus.yml +17 -0
- package/plugins/specweave-kafka/monitoring/prometheus/kafka-alerts.yml +415 -0
- package/plugins/specweave-kafka/monitoring/prometheus/kafka-jmx-exporter.yml +256 -0
- package/plugins/specweave-kafka/package.json +41 -0
- package/plugins/specweave-kafka/skills/kafka-architecture/SKILL.md +647 -0
- package/plugins/specweave-kafka/skills/kafka-cli-tools/SKILL.md +433 -0
- package/plugins/specweave-kafka/skills/kafka-iac-deployment/SKILL.md +449 -0
- package/plugins/specweave-kafka/skills/kafka-kubernetes/SKILL.md +667 -0
- package/plugins/specweave-kafka/skills/kafka-mcp-integration/SKILL.md +273 -0
- package/plugins/specweave-kafka/skills/kafka-observability/SKILL.md +576 -0
- package/plugins/specweave-kafka/templates/config/broker-production.properties +254 -0
- package/plugins/specweave-kafka/templates/config/consumer-low-latency.properties +112 -0
- package/plugins/specweave-kafka/templates/config/producer-high-throughput.properties +120 -0
- package/plugins/specweave-kafka/templates/migration/mirrormaker2-config.properties +234 -0
- package/plugins/specweave-kafka/templates/monitoring/grafana/multi-cluster-dashboard.json +686 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/main.tf +347 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/outputs.tf +107 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/templates/kafka-broker-init.sh.tpl +216 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/variables.tf +156 -0
- package/plugins/specweave-kafka/terraform/aws-msk/main.tf +362 -0
- package/plugins/specweave-kafka/terraform/aws-msk/outputs.tf +93 -0
- package/plugins/specweave-kafka/terraform/aws-msk/templates/server.properties.tpl +32 -0
- package/plugins/specweave-kafka/terraform/aws-msk/variables.tf +235 -0
- package/plugins/specweave-kafka/terraform/azure-event-hubs/main.tf +281 -0
- package/plugins/specweave-kafka/terraform/azure-event-hubs/outputs.tf +118 -0
- package/plugins/specweave-kafka/terraform/azure-event-hubs/variables.tf +148 -0
- package/plugins/specweave-kafka/tsconfig.json +21 -0
- package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-kafka-streams/README.md +310 -0
- package/plugins/specweave-kafka-streams/skills/kafka-streams-topology/SKILL.md +539 -0
- package/plugins/specweave-n8n/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-n8n/README.md +354 -0
- package/plugins/specweave-n8n/skills/n8n-kafka-workflows/SKILL.md +504 -0
- package/plugins/specweave-release/commands/specweave-release-platform.md +1 -1
- package/plugins/specweave-release/hooks/post-task-completion.sh +2 -2
- package/src/templates/AGENTS.md.template +601 -7
- package/src/templates/CLAUDE.md.template +188 -88
- package/dist/locales/de/.gitkeep +0 -0
- package/dist/locales/de/cli.json +0 -108
- package/dist/locales/en/cli.json +0 -287
- package/dist/locales/en/errors.json +0 -7
- package/dist/locales/en/templates.json +0 -6
- package/dist/locales/es/.gitkeep +0 -0
- package/dist/locales/es/cli.json +0 -41
- package/dist/locales/fr/.gitkeep +0 -0
- package/dist/locales/fr/cli.json +0 -108
- package/dist/locales/ja/.gitkeep +0 -0
- package/dist/locales/ja/cli.json +0 -108
- package/dist/locales/ko/.gitkeep +0 -0
- package/dist/locales/ko/cli.json +0 -108
- package/dist/locales/pt/.gitkeep +0 -0
- package/dist/locales/pt/cli.json +0 -108
- package/dist/locales/ru/.gitkeep +0 -0
- package/dist/locales/ru/cli.json +0 -269
- package/dist/locales/zh/.gitkeep +0 -0
- package/dist/locales/zh/cli.json +0 -108
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts +0 -25
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -191
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js.map +0 -1
- package/dist/spec-parser.js +0 -629
- package/dist/src/core/sync/spec-content-sync.d.ts +0 -88
- package/dist/src/core/sync/spec-content-sync.d.ts.map +0 -1
- package/dist/src/core/sync/spec-content-sync.js +0 -5
- package/dist/src/core/sync/spec-content-sync.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/plugins/specweave-ado/commands/specweave-ado-sync-spec.md +0 -255
- package/plugins/specweave-github/commands/specweave-github-sync-epic.md +0 -248
- package/plugins/specweave-github/commands/specweave-github-sync-from.md +0 -147
- package/plugins/specweave-github/commands/specweave-github-sync-spec.md +0 -208
- package/plugins/specweave-github/commands/specweave-github-sync-tasks.md +0 -530
- package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +0 -267
- package/plugins/specweave-jira/commands/specweave-jira-sync-spec.md +0 -240
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Apache Kafka Terraform Module - Variables
|
|
2
|
+
|
|
3
|
+
variable "environment" {
|
|
4
|
+
description = "Environment name (dev, staging, prod)"
|
|
5
|
+
type = string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
variable "cluster_name" {
|
|
9
|
+
description = "Kafka cluster name"
|
|
10
|
+
type = string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
variable "kafka_version" {
|
|
14
|
+
description = "Apache Kafka version (3.6.0+)"
|
|
15
|
+
type = string
|
|
16
|
+
default = "3.7.0"
|
|
17
|
+
|
|
18
|
+
validation {
|
|
19
|
+
condition = can(regex("^3\\.[6-9]\\.", var.kafka_version))
|
|
20
|
+
error_message = "Kafka version must be 3.6.0 or higher for KRaft support."
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
variable "broker_count" {
|
|
25
|
+
description = "Number of Kafka brokers (min 3 for KRaft quorum)"
|
|
26
|
+
type = number
|
|
27
|
+
default = 3
|
|
28
|
+
|
|
29
|
+
validation {
|
|
30
|
+
condition = var.broker_count >= 3
|
|
31
|
+
error_message = "Broker count must be at least 3 for KRaft mode."
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
variable "instance_type" {
|
|
36
|
+
description = "EC2 instance type for brokers (null = auto-select based on workload_profile)"
|
|
37
|
+
type = string
|
|
38
|
+
default = null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
variable "workload_profile" {
|
|
42
|
+
description = "Workload profile for auto-sizing (high-throughput, balanced, low-latency)"
|
|
43
|
+
type = string
|
|
44
|
+
default = "balanced"
|
|
45
|
+
|
|
46
|
+
validation {
|
|
47
|
+
condition = contains(["high-throughput", "balanced", "low-latency"], var.workload_profile)
|
|
48
|
+
error_message = "Workload profile must be: high-throughput, balanced, or low-latency."
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
variable "data_disk_count" {
|
|
53
|
+
description = "Number of data disks per broker (RAID 0)"
|
|
54
|
+
type = number
|
|
55
|
+
default = 2
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
variable "disk_size_gb" {
|
|
59
|
+
description = "Size of each data disk in GB"
|
|
60
|
+
type = number
|
|
61
|
+
default = 1000
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
variable "disk_type" {
|
|
65
|
+
description = "EBS volume type (gp3 or io2)"
|
|
66
|
+
type = string
|
|
67
|
+
default = "gp3"
|
|
68
|
+
|
|
69
|
+
validation {
|
|
70
|
+
condition = contains(["gp3", "io2"], var.disk_type)
|
|
71
|
+
error_message = "Disk type must be gp3 or io2."
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
variable "disk_iops" {
|
|
76
|
+
description = "Disk IOPS (for io2 only)"
|
|
77
|
+
type = number
|
|
78
|
+
default = null
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
variable "disk_throughput" {
|
|
82
|
+
description = "Disk throughput in MB/s (for gp3 only, max 1000)"
|
|
83
|
+
type = number
|
|
84
|
+
default = 500
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
variable "heap_size_gb" {
|
|
88
|
+
description = "JVM heap size in GB (null = auto-calculate)"
|
|
89
|
+
type = number
|
|
90
|
+
default = null
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
variable "vpc_id" {
|
|
94
|
+
description = "VPC ID for Kafka cluster"
|
|
95
|
+
type = string
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
variable "subnet_ids" {
|
|
99
|
+
description = "List of subnet IDs (spread across AZs)"
|
|
100
|
+
type = list(string)
|
|
101
|
+
|
|
102
|
+
validation {
|
|
103
|
+
condition = length(var.subnet_ids) >= 3
|
|
104
|
+
error_message = "At least 3 subnets required for high availability."
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
variable "key_name" {
|
|
109
|
+
description = "SSH key pair name for EC2 instances"
|
|
110
|
+
type = string
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
variable "allowed_cidr_blocks" {
|
|
114
|
+
description = "CIDR blocks allowed to connect to Kafka (clients)"
|
|
115
|
+
type = list(string)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
variable "monitoring_cidr_blocks" {
|
|
119
|
+
description = "CIDR blocks allowed to access JMX/Prometheus metrics"
|
|
120
|
+
type = list(string)
|
|
121
|
+
default = []
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
variable "route53_zone_id" {
|
|
125
|
+
description = "Route53 hosted zone ID for DNS records"
|
|
126
|
+
type = string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
variable "domain" {
|
|
130
|
+
description = "Domain for DNS records (e.g., kafka.example.com)"
|
|
131
|
+
type = string
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
variable "kms_key_id" {
|
|
135
|
+
description = "KMS key ID for encryption (null = use default AWS key)"
|
|
136
|
+
type = string
|
|
137
|
+
default = null
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
variable "ami_id" {
|
|
141
|
+
description = "Custom AMI ID (null = use latest Amazon Linux 2)"
|
|
142
|
+
type = string
|
|
143
|
+
default = null
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
variable "sns_alarm_topic_arn" {
|
|
147
|
+
description = "SNS topic ARN for CloudWatch alarms"
|
|
148
|
+
type = string
|
|
149
|
+
default = null
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
variable "tags" {
|
|
153
|
+
description = "Additional tags for all resources"
|
|
154
|
+
type = map(string)
|
|
155
|
+
default = {}
|
|
156
|
+
}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# AWS MSK (Managed Streaming for Kafka) - Terraform Module
|
|
2
|
+
#
|
|
3
|
+
# Provisions production-ready AWS MSK cluster with monitoring, encryption, and IAM auth.
|
|
4
|
+
|
|
5
|
+
terraform {
|
|
6
|
+
required_version = ">= 1.5.0"
|
|
7
|
+
|
|
8
|
+
required_providers {
|
|
9
|
+
aws = {
|
|
10
|
+
source = "hashicorp/aws"
|
|
11
|
+
version = "~> 5.0"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
locals {
|
|
17
|
+
cluster_name = "${var.environment}-${var.cluster_name}"
|
|
18
|
+
|
|
19
|
+
# Auto-select instance type based on workload
|
|
20
|
+
broker_instance_type = var.broker_instance_type != null ? var.broker_instance_type : (
|
|
21
|
+
var.workload_profile == "high-throughput" ? "kafka.m5.4xlarge" :
|
|
22
|
+
var.workload_profile == "balanced" ? "kafka.m5.2xlarge" :
|
|
23
|
+
"kafka.m5.xlarge"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Storage per broker
|
|
27
|
+
storage_per_broker_gb = var.storage_per_broker_gb != null ? var.storage_per_broker_gb : (
|
|
28
|
+
var.workload_profile == "high-throughput" ? 2000 :
|
|
29
|
+
var.workload_profile == "balanced" ? 1000 :
|
|
30
|
+
500
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
common_tags = merge(var.tags, {
|
|
34
|
+
Environment = var.environment
|
|
35
|
+
ManagedBy = "Terraform"
|
|
36
|
+
ClusterName = local.cluster_name
|
|
37
|
+
Service = "MSK"
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# ========================================
|
|
42
|
+
# MSK Cluster
|
|
43
|
+
# ========================================
|
|
44
|
+
|
|
45
|
+
resource "aws_msk_cluster" "main" {
|
|
46
|
+
cluster_name = local.cluster_name
|
|
47
|
+
kafka_version = var.kafka_version
|
|
48
|
+
number_of_broker_nodes = var.number_of_broker_nodes
|
|
49
|
+
|
|
50
|
+
broker_node_group_info {
|
|
51
|
+
instance_type = local.broker_instance_type
|
|
52
|
+
client_subnets = var.subnet_ids
|
|
53
|
+
security_groups = [aws_security_group.msk_cluster.id]
|
|
54
|
+
|
|
55
|
+
storage_info {
|
|
56
|
+
ebs_storage_info {
|
|
57
|
+
volume_size = local.storage_per_broker_gb
|
|
58
|
+
provisioned_throughput {
|
|
59
|
+
enabled = var.enable_provisioned_throughput
|
|
60
|
+
volume_throughput = var.enable_provisioned_throughput ? var.provisioned_throughput_mbps : null
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
connectivity_info {
|
|
66
|
+
public_access {
|
|
67
|
+
type = var.enable_public_access ? "SERVICE_PROVIDED_EIPS" : "DISABLED"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
encryption_info {
|
|
73
|
+
encryption_in_transit {
|
|
74
|
+
client_broker = var.encryption_in_transit_client_broker
|
|
75
|
+
in_cluster = true
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
encryption_at_rest_kms_key_arn = var.kms_key_arn
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
client_authentication {
|
|
82
|
+
sasl {
|
|
83
|
+
iam = var.enable_iam_auth
|
|
84
|
+
scram = var.enable_scram_auth
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
tls {
|
|
88
|
+
certificate_authority_arns = var.tls_ca_arns
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
unauthenticated = var.allow_unauthenticated
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
configuration_info {
|
|
95
|
+
arn = aws_msk_configuration.main.arn
|
|
96
|
+
revision = aws_msk_configuration.main.latest_revision
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
open_monitoring {
|
|
100
|
+
prometheus {
|
|
101
|
+
jmx_exporter {
|
|
102
|
+
enabled_in_broker = true
|
|
103
|
+
}
|
|
104
|
+
node_exporter {
|
|
105
|
+
enabled_in_broker = true
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
logging_info {
|
|
111
|
+
broker_logs {
|
|
112
|
+
cloudwatch_logs {
|
|
113
|
+
enabled = var.enable_cloudwatch_logs
|
|
114
|
+
log_group = var.enable_cloudwatch_logs ? aws_cloudwatch_log_group.msk_broker[0].name : null
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
firehose {
|
|
118
|
+
enabled = var.enable_firehose_logs
|
|
119
|
+
delivery_stream = var.enable_firehose_logs ? var.firehose_delivery_stream_name : null
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
s3 {
|
|
123
|
+
enabled = var.enable_s3_logs
|
|
124
|
+
bucket = var.enable_s3_logs ? aws_s3_bucket.msk_logs[0].bucket : null
|
|
125
|
+
prefix = var.enable_s3_logs ? "msk-logs/" : null
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
tags = merge(local.common_tags, {
|
|
131
|
+
Name = local.cluster_name
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# ========================================
|
|
136
|
+
# MSK Configuration
|
|
137
|
+
# ========================================
|
|
138
|
+
|
|
139
|
+
resource "aws_msk_configuration" "main" {
|
|
140
|
+
name = "${local.cluster_name}-config"
|
|
141
|
+
kafka_versions = [var.kafka_version]
|
|
142
|
+
server_properties = templatefile("${path.module}/templates/server.properties.tpl", {
|
|
143
|
+
auto_create_topics_enable = var.auto_create_topics_enable
|
|
144
|
+
default_replication_factor = var.default_replication_factor
|
|
145
|
+
min_insync_replicas = var.min_insync_replicas
|
|
146
|
+
log_retention_hours = var.log_retention_hours
|
|
147
|
+
log_segment_bytes = var.log_segment_bytes
|
|
148
|
+
compression_type = var.compression_type
|
|
149
|
+
num_io_threads = var.num_io_threads
|
|
150
|
+
num_network_threads = var.num_network_threads
|
|
151
|
+
num_replica_fetchers = var.num_replica_fetchers
|
|
152
|
+
socket_request_max_bytes = var.socket_request_max_bytes
|
|
153
|
+
unclean_leader_election_enable = var.unclean_leader_election_enable
|
|
154
|
+
delete_topic_enable = var.delete_topic_enable
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
description = "MSK cluster configuration for ${local.cluster_name}"
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# ========================================
|
|
161
|
+
# Security Group
|
|
162
|
+
# ========================================
|
|
163
|
+
|
|
164
|
+
resource "aws_security_group" "msk_cluster" {
|
|
165
|
+
name_prefix = "${local.cluster_name}-msk-"
|
|
166
|
+
description = "Security group for MSK cluster"
|
|
167
|
+
vpc_id = var.vpc_id
|
|
168
|
+
|
|
169
|
+
# Plaintext (if enabled)
|
|
170
|
+
dynamic "ingress" {
|
|
171
|
+
for_each = var.encryption_in_transit_client_broker == "PLAINTEXT" ? [1] : []
|
|
172
|
+
content {
|
|
173
|
+
description = "Kafka plaintext"
|
|
174
|
+
from_port = 9092
|
|
175
|
+
to_port = 9092
|
|
176
|
+
protocol = "tcp"
|
|
177
|
+
cidr_blocks = var.allowed_cidr_blocks
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
# TLS
|
|
182
|
+
dynamic "ingress" {
|
|
183
|
+
for_each = contains(["TLS", "TLS_PLAINTEXT"], var.encryption_in_transit_client_broker) ? [1] : []
|
|
184
|
+
content {
|
|
185
|
+
description = "Kafka TLS"
|
|
186
|
+
from_port = 9094
|
|
187
|
+
to_port = 9094
|
|
188
|
+
protocol = "tcp"
|
|
189
|
+
cidr_blocks = var.allowed_cidr_blocks
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
# SASL/SCRAM
|
|
194
|
+
dynamic "ingress" {
|
|
195
|
+
for_each = var.enable_scram_auth ? [1] : []
|
|
196
|
+
content {
|
|
197
|
+
description = "Kafka SASL/SCRAM"
|
|
198
|
+
from_port = 9096
|
|
199
|
+
to_port = 9096
|
|
200
|
+
protocol = "tcp"
|
|
201
|
+
cidr_blocks = var.allowed_cidr_blocks
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
# IAM auth
|
|
206
|
+
dynamic "ingress" {
|
|
207
|
+
for_each = var.enable_iam_auth ? [1] : []
|
|
208
|
+
content {
|
|
209
|
+
description = "Kafka IAM auth"
|
|
210
|
+
from_port = 9098
|
|
211
|
+
to_port = 9098
|
|
212
|
+
protocol = "tcp"
|
|
213
|
+
cidr_blocks = var.allowed_cidr_blocks
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
# ZooKeeper (legacy, only if not Kafka 3.0+)
|
|
218
|
+
dynamic "ingress" {
|
|
219
|
+
for_each = !startswith(var.kafka_version, "3.") ? [1] : []
|
|
220
|
+
content {
|
|
221
|
+
description = "ZooKeeper"
|
|
222
|
+
from_port = 2181
|
|
223
|
+
to_port = 2181
|
|
224
|
+
protocol = "tcp"
|
|
225
|
+
cidr_blocks = var.allowed_cidr_blocks
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
egress {
|
|
230
|
+
description = "Allow all outbound"
|
|
231
|
+
from_port = 0
|
|
232
|
+
to_port = 0
|
|
233
|
+
protocol = "-1"
|
|
234
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
tags = merge(local.common_tags, {
|
|
238
|
+
Name = "${local.cluster_name}-msk-sg"
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
# ========================================
|
|
243
|
+
# CloudWatch Log Group
|
|
244
|
+
# ========================================
|
|
245
|
+
|
|
246
|
+
resource "aws_cloudwatch_log_group" "msk_broker" {
|
|
247
|
+
count = var.enable_cloudwatch_logs ? 1 : 0
|
|
248
|
+
|
|
249
|
+
name = "/aws/msk/${local.cluster_name}"
|
|
250
|
+
retention_in_days = var.cloudwatch_log_retention_days
|
|
251
|
+
kms_key_id = var.kms_key_arn
|
|
252
|
+
|
|
253
|
+
tags = local.common_tags
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
# ========================================
|
|
257
|
+
# S3 Bucket for Logs
|
|
258
|
+
# ========================================
|
|
259
|
+
|
|
260
|
+
resource "aws_s3_bucket" "msk_logs" {
|
|
261
|
+
count = var.enable_s3_logs ? 1 : 0
|
|
262
|
+
|
|
263
|
+
bucket_prefix = "${local.cluster_name}-msk-logs-"
|
|
264
|
+
|
|
265
|
+
tags = merge(local.common_tags, {
|
|
266
|
+
Name = "${local.cluster_name}-msk-logs"
|
|
267
|
+
})
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
resource "aws_s3_bucket_server_side_encryption_configuration" "msk_logs" {
|
|
271
|
+
count = var.enable_s3_logs ? 1 : 0
|
|
272
|
+
|
|
273
|
+
bucket = aws_s3_bucket.msk_logs[0].id
|
|
274
|
+
|
|
275
|
+
rule {
|
|
276
|
+
apply_server_side_encryption_by_default {
|
|
277
|
+
sse_algorithm = "aws:kms"
|
|
278
|
+
kms_master_key_id = var.kms_key_arn
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
resource "aws_s3_bucket_lifecycle_configuration" "msk_logs" {
|
|
284
|
+
count = var.enable_s3_logs ? 1 : 0
|
|
285
|
+
|
|
286
|
+
bucket = aws_s3_bucket.msk_logs[0].id
|
|
287
|
+
|
|
288
|
+
rule {
|
|
289
|
+
id = "archive-logs"
|
|
290
|
+
status = "Enabled"
|
|
291
|
+
|
|
292
|
+
transition {
|
|
293
|
+
days = 30
|
|
294
|
+
storage_class = "GLACIER"
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
expiration {
|
|
298
|
+
days = 90
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
# ========================================
|
|
304
|
+
# CloudWatch Alarms
|
|
305
|
+
# ========================================
|
|
306
|
+
|
|
307
|
+
resource "aws_cloudwatch_metric_alarm" "cpu_utilization" {
|
|
308
|
+
alarm_name = "${local.cluster_name}-cpu-high"
|
|
309
|
+
comparison_operator = "GreaterThanThreshold"
|
|
310
|
+
evaluation_periods = 2
|
|
311
|
+
metric_name = "CpuUser"
|
|
312
|
+
namespace = "AWS/Kafka"
|
|
313
|
+
period = 300
|
|
314
|
+
statistic = "Average"
|
|
315
|
+
threshold = 80
|
|
316
|
+
alarm_description = "MSK cluster CPU usage > 80%"
|
|
317
|
+
alarm_actions = var.sns_alarm_topic_arn != null ? [var.sns_alarm_topic_arn] : []
|
|
318
|
+
|
|
319
|
+
dimensions = {
|
|
320
|
+
"Cluster Name" = aws_msk_cluster.main.cluster_name
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
tags = local.common_tags
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
resource "aws_cloudwatch_metric_alarm" "under_replicated_partitions" {
|
|
327
|
+
alarm_name = "${local.cluster_name}-under-replicated"
|
|
328
|
+
comparison_operator = "GreaterThanThreshold"
|
|
329
|
+
evaluation_periods = 2
|
|
330
|
+
metric_name = "UnderReplicatedPartitions"
|
|
331
|
+
namespace = "AWS/Kafka"
|
|
332
|
+
period = 60
|
|
333
|
+
statistic = "Maximum"
|
|
334
|
+
threshold = 0
|
|
335
|
+
alarm_description = "MSK cluster has under-replicated partitions"
|
|
336
|
+
alarm_actions = var.sns_alarm_topic_arn != null ? [var.sns_alarm_topic_arn] : []
|
|
337
|
+
|
|
338
|
+
dimensions = {
|
|
339
|
+
"Cluster Name" = aws_msk_cluster.main.cluster_name
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
tags = local.common_tags
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
resource "aws_cloudwatch_metric_alarm" "offline_partitions" {
|
|
346
|
+
alarm_name = "${local.cluster_name}-offline-partitions"
|
|
347
|
+
comparison_operator = "GreaterThanThreshold"
|
|
348
|
+
evaluation_periods = 1
|
|
349
|
+
metric_name = "OfflinePartitionsCount"
|
|
350
|
+
namespace = "AWS/Kafka"
|
|
351
|
+
period = 60
|
|
352
|
+
statistic = "Maximum"
|
|
353
|
+
threshold = 0
|
|
354
|
+
alarm_description = "MSK cluster has offline partitions (CRITICAL)"
|
|
355
|
+
alarm_actions = var.sns_alarm_topic_arn != null ? [var.sns_alarm_topic_arn] : []
|
|
356
|
+
|
|
357
|
+
dimensions = {
|
|
358
|
+
"Cluster Name" = aws_msk_cluster.main.cluster_name
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
tags = local.common_tags
|
|
362
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# AWS MSK Terraform Module - Outputs
|
|
2
|
+
|
|
3
|
+
output "cluster_arn" {
|
|
4
|
+
description = "MSK cluster ARN"
|
|
5
|
+
value = aws_msk_cluster.main.arn
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
output "cluster_name" {
|
|
9
|
+
description = "MSK cluster name"
|
|
10
|
+
value = aws_msk_cluster.main.cluster_name
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
output "zookeeper_connect_string" {
|
|
14
|
+
description = "ZooKeeper connection string (legacy)"
|
|
15
|
+
value = aws_msk_cluster.main.zookeeper_connect_string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
output "bootstrap_brokers" {
|
|
19
|
+
description = "Plaintext bootstrap brokers"
|
|
20
|
+
value = aws_msk_cluster.main.bootstrap_brokers
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
output "bootstrap_brokers_tls" {
|
|
24
|
+
description = "TLS bootstrap brokers"
|
|
25
|
+
value = aws_msk_cluster.main.bootstrap_brokers_tls
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
output "bootstrap_brokers_sasl_scram" {
|
|
29
|
+
description = "SASL/SCRAM bootstrap brokers"
|
|
30
|
+
value = var.enable_scram_auth ? aws_msk_cluster.main.bootstrap_brokers_sasl_scram : null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
output "bootstrap_brokers_sasl_iam" {
|
|
34
|
+
description = "IAM auth bootstrap brokers"
|
|
35
|
+
value = var.enable_iam_auth ? aws_msk_cluster.main.bootstrap_brokers_sasl_iam : null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
output "security_group_id" {
|
|
39
|
+
description = "Security group ID for MSK cluster"
|
|
40
|
+
value = aws_security_group.msk_cluster.id
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
output "configuration_arn" {
|
|
44
|
+
description = "MSK configuration ARN"
|
|
45
|
+
value = aws_msk_configuration.main.arn
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
output "configuration_revision" {
|
|
49
|
+
description = "MSK configuration revision"
|
|
50
|
+
value = aws_msk_configuration.main.latest_revision
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
output "connection_examples" {
|
|
54
|
+
description = "Example connection configurations"
|
|
55
|
+
value = {
|
|
56
|
+
java_iam = <<-EOT
|
|
57
|
+
Properties props = new Properties();
|
|
58
|
+
props.put("bootstrap.servers", "${aws_msk_cluster.main.bootstrap_brokers_sasl_iam}");
|
|
59
|
+
props.put("security.protocol", "SASL_SSL");
|
|
60
|
+
props.put("sasl.mechanism", "AWS_MSK_IAM");
|
|
61
|
+
props.put("sasl.jaas.config", "software.amazon.msk.auth.iam.IAMLoginModule required;");
|
|
62
|
+
props.put("sasl.client.callback.handler.class", "software.amazon.msk.auth.iam.IAMClientCallbackHandler");
|
|
63
|
+
EOT
|
|
64
|
+
|
|
65
|
+
nodejs_iam = <<-EOT
|
|
66
|
+
const { Kafka } = require('kafkajs');
|
|
67
|
+
const { KafkaJSAWSIAMAuthenticationMechanism } = require('@jm18457/kafkajs-msk-iam-authentication-mechanism');
|
|
68
|
+
|
|
69
|
+
const kafka = new Kafka({
|
|
70
|
+
clientId: 'my-app',
|
|
71
|
+
brokers: ${jsonencode(split(",", aws_msk_cluster.main.bootstrap_brokers_sasl_iam))},
|
|
72
|
+
ssl: true,
|
|
73
|
+
sasl: {
|
|
74
|
+
mechanism: 'aws',
|
|
75
|
+
authenticationProvider: KafkaJSAWSIAMAuthenticationMechanism({
|
|
76
|
+
region: '${data.aws_region.current.name}'
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
EOT
|
|
81
|
+
|
|
82
|
+
cli_iam = <<-EOT
|
|
83
|
+
# Using kcat (requires aws-msk-iam-auth plugin)
|
|
84
|
+
kcat -b ${aws_msk_cluster.main.bootstrap_brokers_sasl_iam} \\
|
|
85
|
+
-X security.protocol=SASL_SSL \\
|
|
86
|
+
-X sasl.mechanism=AWS_MSK_IAM \\
|
|
87
|
+
-L
|
|
88
|
+
EOT
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Data sources
|
|
93
|
+
data "aws_region" "current" {}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# MSK Server Configuration Template
|
|
2
|
+
|
|
3
|
+
# Topic Management
|
|
4
|
+
auto.create.topics.enable=${auto_create_topics_enable}
|
|
5
|
+
delete.topic.enable=${delete_topic_enable}
|
|
6
|
+
|
|
7
|
+
# Replication
|
|
8
|
+
default.replication.factor=${default_replication_factor}
|
|
9
|
+
min.insync.replicas=${min_insync_replicas}
|
|
10
|
+
offsets.topic.replication.factor=3
|
|
11
|
+
transaction.state.log.replication.factor=3
|
|
12
|
+
transaction.state.log.min.isr=2
|
|
13
|
+
|
|
14
|
+
# Log Retention
|
|
15
|
+
log.retention.hours=${log_retention_hours}
|
|
16
|
+
log.segment.bytes=${log_segment_bytes}
|
|
17
|
+
log.retention.check.interval.ms=300000
|
|
18
|
+
|
|
19
|
+
# Compression
|
|
20
|
+
compression.type=${compression_type}
|
|
21
|
+
|
|
22
|
+
# Performance Tuning
|
|
23
|
+
num.io.threads=${num_io_threads}
|
|
24
|
+
num.network.threads=${num_network_threads}
|
|
25
|
+
num.replica.fetchers=${num_replica_fetchers}
|
|
26
|
+
socket.request.max.bytes=${socket_request_max_bytes}
|
|
27
|
+
|
|
28
|
+
# Leader Election
|
|
29
|
+
unclean.leader.election.enable=${unclean_leader_election_enable}
|
|
30
|
+
|
|
31
|
+
# Group Coordinator
|
|
32
|
+
group.coordinator.rebalance.protocols=classic,cooperative
|