cdk-factory 0.8.0__tar.gz → 0.8.2__tar.gz

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.

Potentially problematic release.


This version of cdk-factory might be problematic. Click here for more details.

Files changed (141) hide show
  1. cdk_factory-0.8.2/CHANGELOG_v0.8.1.md +148 -0
  2. cdk_factory-0.8.2/GEEK_CAFE_FIX.md +241 -0
  3. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/PKG-INFO +1 -1
  4. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/examples/separate-api-gateway/api-gateway-stack.json +1 -3
  5. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/pyproject.toml +1 -1
  6. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/enhanced_ssm_config.py +3 -1
  7. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/interfaces/enhanced_ssm_parameter_mixin.py +30 -19
  8. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/api_gateway/api_gateway_stack.py +20 -1
  9. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/api_gateway_integration_utility.py +7 -0
  10. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/json_loading_utility.py +55 -27
  11. cdk_factory-0.8.2/src/cdk_factory/version.py +1 -0
  12. cdk_factory-0.8.0/src/cdk_factory/version.py +0 -1
  13. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/.gitignore +0 -0
  14. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/.windsurfrules +0 -0
  15. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/LICENSE +0 -0
  16. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/README.md +0 -0
  17. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/archive/README.md +0 -0
  18. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/archive/migrate_to_enhanced_ssm.py +0 -0
  19. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/examples/separate-api-gateway/README.md +0 -0
  20. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/examples/separate-api-gateway/config.json +0 -0
  21. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/examples/separate-api-gateway/lambda-stack.json +0 -0
  22. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/mypy.ini +0 -0
  23. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/publish_to_pypi.py +0 -0
  24. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/publish_to_pypi.sh +0 -0
  25. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/pysetup.py +0 -0
  26. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/pysetup.sh +0 -0
  27. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/requirements.dev.txt +0 -0
  28. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/requirements.tests.txt +0 -0
  29. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/requirements.txt +0 -0
  30. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/run-checks.sh +0 -0
  31. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/run-tests-clean-venv.sh +0 -0
  32. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/run-tests.sh +0 -0
  33. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/__init__.py +0 -0
  34. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/app.py +0 -0
  35. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/builds/README.md +0 -0
  36. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/cdk.json +0 -0
  37. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/commands/command_loader.py +0 -0
  38. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/base_config.py +0 -0
  39. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/cdk_config.py +0 -0
  40. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/deployment.py +0 -0
  41. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/deployment_wave.py +0 -0
  42. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/devops.py +0 -0
  43. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/enhanced_base_config.py +0 -0
  44. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/management.py +0 -0
  45. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/pipeline.py +0 -0
  46. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/pipeline_stage.py +0 -0
  47. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/_resources.py +0 -0
  48. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/api_gateway.py +0 -0
  49. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/apigateway_route_config.py +0 -0
  50. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/auto_scaling.py +0 -0
  51. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/cloudfront.py +0 -0
  52. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/cloudwatch_widget.py +0 -0
  53. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/code_artifact.py +0 -0
  54. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/code_artifact_login.py +0 -0
  55. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/code_repository.py +0 -0
  56. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/cognito.py +0 -0
  57. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/docker.py +0 -0
  58. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/dynamodb.py +0 -0
  59. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/ecr.py +0 -0
  60. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/exisiting.py +0 -0
  61. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/lambda_function.py +0 -0
  62. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/lambda_layers.py +0 -0
  63. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/lambda_triggers.py +0 -0
  64. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/load_balancer.py +0 -0
  65. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/rds.py +0 -0
  66. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/resource_mapping.py +0 -0
  67. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/resource_naming.py +0 -0
  68. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/resource_types.py +0 -0
  69. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/route53.py +0 -0
  70. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/route53_hosted_zone.py +0 -0
  71. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/rum.py +0 -0
  72. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/s3.py +0 -0
  73. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/security_group.py +0 -0
  74. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/security_group_full_stack.py +0 -0
  75. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/sqs.py +0 -0
  76. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/resources/vpc.py +0 -0
  77. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/stack.py +0 -0
  78. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/configurations/workload.py +0 -0
  79. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/cloudfront/cloudfront_distribution_construct.py +0 -0
  80. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/ecr/ecr_construct.py +0 -0
  81. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/lambdas/lambda_function_construct.py +0 -0
  82. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/lambdas/lambda_function_docker_construct.py +0 -0
  83. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/lambdas/lambda_function_role_construct.py +0 -0
  84. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/lambdas/policies/policy_docs.py +0 -0
  85. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/lambdas/policies/policy_statements.py +0 -0
  86. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/s3_buckets/s3_bucket_construct.py +0 -0
  87. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_destination_construct.py +0 -0
  88. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_source_construct.py +0 -0
  89. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/constructs/sqs/policies/sqs_policies.py +0 -0
  90. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/interfaces/istack.py +0 -0
  91. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/interfaces/live_ssm_resolver.py +0 -0
  92. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/interfaces/ssm_parameter_mixin.py +0 -0
  93. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/lambdas/health_handler.py +0 -0
  94. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/pipeline/pipeline_factory.py +0 -0
  95. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/pipeline/security/policies.py +0 -0
  96. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/pipeline/security/roles.py +0 -0
  97. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/pipeline/stage.py +0 -0
  98. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack/istack.py +0 -0
  99. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack/stack_factory.py +0 -0
  100. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack/stack_module_loader.py +0 -0
  101. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack/stack_module_registry.py +0 -0
  102. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack/stack_modules.py +0 -0
  103. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/__init__.py +0 -0
  104. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/auto_scaling/__init__.py +0 -0
  105. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/auto_scaling/auto_scaling_stack.py +0 -0
  106. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/aws_lambdas/lambda_stack.py +0 -0
  107. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/buckets/README.md +0 -0
  108. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/buckets/bucket_stack.py +0 -0
  109. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/code_artifact/code_artifact_stack.py +0 -0
  110. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/cognito/cognito_stack.py +0 -0
  111. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py +0 -0
  112. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/ecr/README.md +0 -0
  113. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/ecr/ecr_stack.py +0 -0
  114. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/load_balancer/__init__.py +0 -0
  115. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/load_balancer/load_balancer_stack.py +0 -0
  116. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/rds/__init__.py +0 -0
  117. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/rds/rds_stack.py +0 -0
  118. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/route53/__init__.py +0 -0
  119. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/route53/route53_stack.py +0 -0
  120. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/rum/__init__.py +0 -0
  121. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/rum/rum_stack.py +0 -0
  122. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/security_group/__init__.py +0 -0
  123. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/security_group/security_group_full_stack.py +0 -0
  124. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/security_group/security_group_stack.py +0 -0
  125. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/simple_queue_service/sqs_stack.py +0 -0
  126. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/stack_base.py +0 -0
  127. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/vpc/__init__.py +0 -0
  128. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/vpc/vpc_stack.py +0 -0
  129. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stack_library/websites/static_website_stack.py +0 -0
  130. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/stages/websites/static_website_stage.py +0 -0
  131. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/commandline_args.py +0 -0
  132. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/configuration_loader.py +0 -0
  133. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/docker_utilities.py +0 -0
  134. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/environment_services.py +0 -0
  135. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/file_operations.py +0 -0
  136. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/git_utilities.py +0 -0
  137. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/lambda_function_utilities.py +0 -0
  138. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utilities/os_execute.py +0 -0
  139. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/utils/api_gateway_utilities.py +0 -0
  140. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/cdk_factory/workload/workload_factory.py +0 -0
  141. {cdk_factory-0.8.0 → cdk_factory-0.8.2}/src/handlers/test/handler.py +0 -0
@@ -0,0 +1,148 @@
1
+ # CDK Factory v0.8.1 Release Notes
2
+
3
+ Released: 2025-10-09
4
+
5
+ ## Bug Fixes
6
+
7
+ ### 1. Fixed SSM Export Configuration Bug
8
+ **Issue**: Documentation showed incorrect pattern `"exports": {"enabled": true}` which caused `AttributeError: 'bool' object has no attribute 'startswith'`
9
+
10
+ **Fix**:
11
+ - Added type validation in `enhanced_ssm_config.py` to handle non-string values
12
+ - Updated documentation to show correct pattern: `"auto_export": true`
13
+ - Created comprehensive documentation in `docs/SSM_EXPORT_FIX.md`
14
+
15
+ **Impact**: Prevents crashes when using incorrect SSM export configuration
16
+
17
+ ### 2. Fixed Cognito User Pool SSM Import for API Gateway
18
+ **Issue**: API Gateway couldn't find Cognito User Pool ARN, causing `ValueError: User pool ID is required for API Gateway authorizer`
19
+
20
+ **Fix**:
21
+ - Enhanced SSM-based import pattern for `user_pool_arn`
22
+ - Created comprehensive guide in `docs/API_GATEWAY_COGNITO_SSM.md`
23
+ - Added auto-discovery support via `"user_pool_arn": "auto"`
24
+
25
+ **Impact**: Enables seamless cross-stack Cognito + API Gateway integration
26
+
27
+ ### 3. Fixed Authorizer Creation When Not Needed
28
+ **Issue**: API Gateway authorizer was created even when all routes were public (`authorization_type: "NONE"`), causing CDK validation error: `ValidationError: Authorizer must be attached to a RestApi`
29
+
30
+ **Fix**:
31
+ - Modified `_setup_cognito_authorizer()` to only create authorizer when at least one route requires it
32
+ - Added `cognito_configured` flag to maintain security validation context
33
+ - Security warnings still emitted for public endpoints when Cognito is available
34
+
35
+ **Impact**:
36
+ - Prevents CDK synthesis errors for public-only APIs
37
+ - Maintains security validation without creating unused resources
38
+ - Reduces AWS resource overhead
39
+
40
+ ### 4. Removed Deprecated SSM Parameter Types
41
+ **Issue**: Using deprecated `ssm.ParameterType.STRING`, `ssm.ParameterType.STRING_LIST`, and `type` parameter caused AWS CDK deprecation warnings
42
+
43
+ **Fix**:
44
+ - Replaced deprecated `ParameterType` enum with appropriate CDK constructs:
45
+ - `StringParameter` for regular strings (no `type` parameter needed)
46
+ - `StringListParameter` for string lists
47
+ - `CfnParameter` with `type="SecureString"` for secure strings
48
+ - Updated `enhanced_ssm_parameter_mixin.py` to use CDK v2 best practices
49
+
50
+ **Impact**:
51
+ - Eliminates deprecation warnings
52
+ - Future-proofs code for CDK v3
53
+ - Follows AWS CDK v2 best practices
54
+
55
+ ## Test Coverage
56
+
57
+ - **153 tests passing** ✅
58
+ - New test coverage:
59
+ - `test_api_gateway_export_config.py` (6 tests)
60
+ - `test_api_gateway_authorizer_ssm_integration.py` (5 tests)
61
+ - `test_cross_stack_ssm_integration.py` (3 tests)
62
+ - `test_api_gateway_enhanced_authorization_validation.py` (6 tests)
63
+
64
+ ## Documentation Added
65
+
66
+ 1. **docs/SSM_EXPORT_FIX.md** - SSM export configuration bug fix guide
67
+ 2. **docs/API_GATEWAY_COGNITO_SSM.md** - Comprehensive Cognito + API Gateway SSM integration guide
68
+ 3. **GEEK_CAFE_FIX.md** - Quick fix guide for geek-cafe project (example usage)
69
+
70
+ ## Breaking Changes
71
+
72
+ None - all changes are backward compatible
73
+
74
+ ## Migration Guide
75
+
76
+ ### If you're using the old export pattern:
77
+
78
+ **Before (v0.8.0 - incorrect docs):**
79
+ ```json
80
+ {
81
+ "ssm": {
82
+ "enabled": true,
83
+ "exports": {
84
+ "enabled": true // ❌ Wrong
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ **After (v0.8.1):**
91
+ ```json
92
+ {
93
+ "ssm": {
94
+ "enabled": true,
95
+ "auto_export": true // ✅ Correct
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### If you're getting Cognito User Pool errors:
101
+
102
+ Add to your API Gateway stack config:
103
+ ```json
104
+ {
105
+ "api_gateway": {
106
+ "ssm": {
107
+ "imports": {
108
+ "user_pool_arn": "auto" // ✅ Add this
109
+ }
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ ### If you have public-only API routes:
116
+
117
+ Your config should work without changes. The authorizer will only be created if needed:
118
+ ```json
119
+ {
120
+ "cognito_authorizer": {
121
+ "authorizer_name": "my-authorizer" // Config present but not used
122
+ },
123
+ "routes": [
124
+ {
125
+ "path": "/public",
126
+ "method": "GET",
127
+ "authorization_type": "NONE", // ✅ Authorizer won't be created
128
+ "allow_public_override": true
129
+ }
130
+ ]
131
+ }
132
+ ```
133
+
134
+ ## Deployment Flow (v0.8.1+)
135
+
136
+ ```
137
+ 1. Cognito Stack → Exports user_pool_arn to SSM
138
+ 2. Lambda Stack → Exports Lambda ARNs to SSM
139
+ 3. API Gateway Stack → Imports both, creates authorizer only if needed
140
+ ```
141
+
142
+ ## Known Issues
143
+
144
+ None
145
+
146
+ ## Contributors
147
+
148
+ - Eric Wilson (@geekcafe)
@@ -0,0 +1,241 @@
1
+ # Fix for geek-cafe Cognito Error
2
+
3
+ ## The Problem
4
+
5
+ ```
6
+ ValueError: User pool ID is required for API Gateway authorizer.
7
+ ```
8
+
9
+ Your API Gateway stack can't find the Cognito User Pool because the new separated pattern requires **SSM imports** instead of environment variables.
10
+
11
+ ## Quick Fix
12
+
13
+ In your `/Users/eric.wilson/Projects/geek-cafe/geek-cafe-web/geek-cafe-lambdas/cdk` config:
14
+
15
+ ### Option 1: Add SSM Import (Recommended)
16
+
17
+ **api-gateway-stack.json:**
18
+ ```json
19
+ {
20
+ "name": "geek-cafe-prod-api-gateway",
21
+ "module": "api_gateway_stack",
22
+ "api_gateway": {
23
+ "name": "geek-cafe-prod-api",
24
+ "api_type": "REST",
25
+ "stage_name": "prod",
26
+ "ssm": {
27
+ "enabled": true,
28
+ "auto_export": true,
29
+ "workload": "geek-cafe",
30
+ "environment": "prod",
31
+ "imports": {
32
+ "workload": "geek-cafe",
33
+ "environment": "prod",
34
+ "user_pool_arn": "auto" // ✅ ADD THIS - imports from Cognito stack
35
+ }
36
+ },
37
+ "cognito_authorizer": {
38
+ "authorizer_name": "geek-cafe-cognito-authorizer"
39
+ },
40
+ "routes": [...]
41
+ }
42
+ }
43
+ ```
44
+
45
+ This assumes your Cognito stack is configured to export:
46
+ ```json
47
+ {
48
+ "name": "geek-cafe-prod-cognito",
49
+ "module": "cognito_stack",
50
+ "ssm": {
51
+ "enabled": true,
52
+ "auto_export": true, // ✅ Must be enabled
53
+ "workload": "geek-cafe",
54
+ "environment": "prod"
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Option 2: Use Explicit SSM Path
60
+
61
+ If auto-discovery doesn't work, find the exact SSM parameter:
62
+
63
+ ```bash
64
+ # Find the parameter
65
+ aws ssm get-parameters-by-path --path "/geek-cafe/prod/cognito" --recursive
66
+ ```
67
+
68
+ Then use the explicit path:
69
+ ```json
70
+ {
71
+ "api_gateway": {
72
+ "ssm": {
73
+ "imports": {
74
+ "user_pool_arn": "/geek-cafe/prod/cognito/user-pool/user-pool-arn"
75
+ }
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ ### Option 3: Direct ARN (Quick Temporary Fix)
82
+
83
+ If you just need to deploy NOW and fix properly later:
84
+
85
+ ```json
86
+ {
87
+ "api_gateway": {
88
+ "cognito_authorizer": {
89
+ "authorizer_name": "geek-cafe-authorizer",
90
+ "user_pool_arn": "arn:aws:cognito-idp:us-east-1:ACCOUNT_ID:userpool/us-east-1_XXXXX"
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ Get the ARN from AWS Console → Cognito → User Pools → geek-cafe-prod → ARN
97
+
98
+ ## Deployment Order
99
+
100
+ With the new pattern, deploy in this order:
101
+
102
+ ```bash
103
+ # 1. Deploy Cognito (if separate stack)
104
+ cdk deploy geek-cafe-prod-cognito
105
+
106
+ # 2. Deploy Lambdas
107
+ cdk deploy geek-cafe-prod-lambdas
108
+
109
+ # 3. Deploy API Gateway (imports from both above)
110
+ cdk deploy geek-cafe-prod-api-gateway
111
+ ```
112
+
113
+ Or set up a pipeline with stages:
114
+ ```json
115
+ {
116
+ "pipeline": {
117
+ "stages": [
118
+ {"name": "infrastructure", "stacks": ["cognito-stack"]},
119
+ {"name": "lambdas", "stacks": ["lambda-stack"]},
120
+ {"name": "api-gateway", "stacks": ["api-gateway-stack"]}
121
+ ]
122
+ }
123
+ }
124
+ ```
125
+
126
+ ## Verify SSM Parameters Exist
127
+
128
+ ```bash
129
+ # Check what Cognito exported
130
+ aws ssm get-parameter --name "/geek-cafe/prod/cognito/user-pool/user-pool-arn"
131
+
132
+ # Check what Lambda exported
133
+ aws ssm get-parameters-by-path --path "/geek-cafe/prod/lambda" --recursive
134
+
135
+ # Check what API Gateway exported
136
+ aws ssm get-parameters-by-path --path "/geek-cafe/prod/api-gateway" --recursive
137
+ ```
138
+
139
+ ## Complete Example Config
140
+
141
+ **cognito-stack.json:**
142
+ ```json
143
+ {
144
+ "name": "geek-cafe-prod-cognito",
145
+ "module": "cognito_stack",
146
+ "ssm": {
147
+ "enabled": true,
148
+ "auto_export": true,
149
+ "workload": "geek-cafe",
150
+ "environment": "prod"
151
+ },
152
+ "cognito": {
153
+ "user_pool_name": "geek-cafe-prod",
154
+ "exists": false
155
+ }
156
+ }
157
+ ```
158
+
159
+ **lambda-stack.json:**
160
+ ```json
161
+ {
162
+ "name": "geek-cafe-prod-lambdas",
163
+ "module": "lambda_stack",
164
+ "ssm": {
165
+ "enabled": true,
166
+ "workload": "geek-cafe",
167
+ "environment": "prod"
168
+ },
169
+ "resources": [
170
+ {
171
+ "name": "geek-cafe-prod-get-cafes",
172
+ "src": "./src/handlers/cafes",
173
+ "handler": "get_cafes.lambda_handler"
174
+ }
175
+ ]
176
+ }
177
+ ```
178
+
179
+ **api-gateway-stack.json:**
180
+ ```json
181
+ {
182
+ "name": "geek-cafe-prod-api-gateway",
183
+ "module": "api_gateway_stack",
184
+ "api_gateway": {
185
+ "name": "geek-cafe-prod-api",
186
+ "api_type": "REST",
187
+ "stage_name": "prod",
188
+ "ssm": {
189
+ "enabled": true,
190
+ "auto_export": true,
191
+ "workload": "geek-cafe",
192
+ "environment": "prod",
193
+ "imports": {
194
+ "workload": "geek-cafe",
195
+ "environment": "prod",
196
+ "user_pool_arn": "auto" // ✅ This is the key fix
197
+ }
198
+ },
199
+ "cognito_authorizer": {
200
+ "authorizer_name": "geek-cafe-cognito-authorizer"
201
+ },
202
+ "routes": [
203
+ {
204
+ "path": "/cafes",
205
+ "method": "GET",
206
+ "lambda_name": "geek-cafe-prod-get-cafes",
207
+ "authorization_type": "COGNITO_USER_POOLS"
208
+ }
209
+ ]
210
+ }
211
+ }
212
+ ```
213
+
214
+ ## Summary of Changes
215
+
216
+ | Old Pattern (Combined) | New Pattern (Separated) |
217
+ |------------------------|-------------------------|
218
+ | `COGNITO_USER_POOL_ID` env var | SSM import with `user_pool_arn: "auto"` |
219
+ | Single stack with Lambda + API | Three stacks: Cognito → Lambda → API Gateway |
220
+ | Environment vars in CI/CD | Config-driven SSM parameters |
221
+ | `"exports": {"enabled": true}` ❌ | `"auto_export": true` ✅ |
222
+
223
+ ## If Still Having Issues
224
+
225
+ 1. **Check CDK Factory version:**
226
+ ```bash
227
+ pip show cdk-factory
228
+ # Should be v0.8.0 or higher
229
+ ```
230
+
231
+ 2. **Enable debug logging:**
232
+ ```bash
233
+ export LOG_LEVEL=DEBUG
234
+ cdk deploy
235
+ ```
236
+
237
+ 3. **Verify workload/environment match** in all three stacks
238
+
239
+ 4. **Check SSM permissions** in your deployment role
240
+
241
+ 5. **Use explicit path** as fallback if auto-discovery fails
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdk_factory
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: CDK Factory. A QuickStarter and best practices setup for CDK projects
5
5
  Author-email: Eric Wilson <eric.wilson@geekcafe.com>
6
6
  License: MIT License
@@ -9,11 +9,9 @@
9
9
  "stage_name": "prod",
10
10
  "ssm": {
11
11
  "enabled": true,
12
+ "auto_export": true,
12
13
  "workload": "{{WORKLOAD_NAME}}",
13
14
  "environment": "{{ENVIRONMENT}}",
14
- "exports": {
15
- "enabled": true
16
- },
17
15
  "imports": {
18
16
  "workload": "{{WORKLOAD_NAME}}",
19
17
  "environment": "{{ENVIRONMENT}}"
@@ -33,7 +33,7 @@ markers = [
33
33
  [project]
34
34
 
35
35
  name = "cdk_factory"
36
- version = "0.8.0"
36
+ version = "0.8.2"
37
37
  authors = [
38
38
  { name="Eric Wilson", email="eric.wilson@geekcafe.com" }
39
39
  ]
@@ -86,7 +86,9 @@ class EnhancedSsmConfig:
86
86
  self, attribute: str, custom_path: Optional[str] = None
87
87
  ) -> str:
88
88
  """Generate SSM parameter path using pattern or custom path"""
89
- if custom_path and custom_path.startswith("/"):
89
+ # Handle custom_path - must be a string starting with "/"
90
+ # Protect against incorrect config like: "exports": {"enabled": true}
91
+ if custom_path and isinstance(custom_path, str) and custom_path.startswith("/"):
90
92
  return custom_path
91
93
 
92
94
  # Convert underscore attribute names to hyphen format for consistent SSM paths
@@ -142,28 +142,39 @@ class EnhancedSsmParameterMixin:
142
142
  Returns:
143
143
  Created SSM parameter
144
144
  """
145
- # Handle different value types
146
- if isinstance(value, list):
147
- string_value = ",".join(str(v) for v in value)
148
- cdk_param_type = ssm.ParameterType.STRING_LIST
149
- elif param_type == "SecureString":
150
- string_value = str(value)
151
- cdk_param_type = ssm.ParameterType.SECURE_STRING
152
- else:
153
- string_value = str(value)
154
- cdk_param_type = ssm.ParameterType.STRING
155
-
156
145
  # Generate a unique construct ID from the path
157
146
  construct_id = f"ssm-param-{path.replace('/', '-').replace('_', '-')}"
158
147
 
159
- return ssm.StringParameter(
160
- self.scope,
161
- construct_id,
162
- parameter_name=path,
163
- string_value=string_value,
164
- description=description,
165
- type=cdk_param_type
166
- )
148
+ # Handle different value types - use appropriate CDK constructs
149
+ if isinstance(value, list):
150
+ # For list values, use StringListParameter
151
+ return ssm.StringListParameter(
152
+ self.scope,
153
+ construct_id,
154
+ parameter_name=path,
155
+ string_list_value=value,
156
+ description=description
157
+ )
158
+ elif param_type == "SecureString":
159
+ # For secure strings, use L1 CfnParameter with Type=SecureString
160
+ return ssm.CfnParameter(
161
+ self.scope,
162
+ construct_id,
163
+ name=path,
164
+ value=str(value),
165
+ type="SecureString",
166
+ description=description
167
+ )
168
+ else:
169
+ # For regular strings, use StringParameter (no type parameter needed in CDK v2)
170
+ return ssm.StringParameter(
171
+ self.scope,
172
+ construct_id,
173
+ parameter_name=path,
174
+ string_value=str(value),
175
+ description=description
176
+ # Note: 'type' parameter removed - deprecated in CDK v2
177
+ )
167
178
 
168
179
  def _import_enhanced_ssm_parameter(self, path: str, attribute: str) -> Optional[str]:
169
180
  """
@@ -304,9 +304,28 @@ class ApiGatewayStack(IStack, EnhancedSsmParameterMixin):
304
304
  )
305
305
 
306
306
  def _setup_cognito_authorizer(self, api_gateway, api_id):
307
- """Setup Cognito authorizer if configured"""
307
+ """Setup Cognito authorizer if configured AND if any routes need it"""
308
308
  if not self.api_config.cognito_authorizer:
309
309
  return None
310
+
311
+ # Check if any routes actually need the authorizer
312
+ # Don't create it if all routes are public (authorization_type: NONE)
313
+ routes = self.api_config.routes or []
314
+ needs_authorizer = any(
315
+ route.get("authorization_type") != "NONE"
316
+ for route in routes
317
+ )
318
+
319
+ # If we're not creating an authorizer but Cognito is configured,
320
+ # inform the integration utility so it can still perform security validations
321
+ if not needs_authorizer:
322
+ logger.info(
323
+ "Cognito authorizer configured but no routes require authorization. "
324
+ "Skipping authorizer creation but maintaining security validation context."
325
+ )
326
+ # Set a flag so the integration utility knows Cognito was available
327
+ self.integration_utility.cognito_configured = True
328
+ return None
310
329
 
311
330
  route_config = ApiGatewayConfigRouteConfig({})
312
331
  return self.integration_utility.get_or_create_authorizer(
@@ -40,6 +40,7 @@ class ApiGatewayIntegrationUtility:
40
40
  self.account = scope.account
41
41
  self.api_gateway = None
42
42
  self.authorizer = None
43
+ self.cognito_configured = False # Flag for when Cognito is configured but authorizer not created
43
44
  self._log_group = None
44
45
  self._log_role = None
45
46
 
@@ -55,8 +56,10 @@ class ApiGatewayIntegrationUtility:
55
56
  raise ValueError("API Gateway config is missing in Lambda function config")
56
57
 
57
58
  # Validate authorization configuration for security
59
+ # Check if Cognito is available (either authorizer created OR configured but not created)
58
60
  has_cognito_authorizer = (
59
61
  self.authorizer is not None
62
+ or self.cognito_configured
60
63
  or self._get_existing_authorizer_id_with_ssm_fallback(
61
64
  api_config, stack_config
62
65
  )
@@ -614,6 +617,10 @@ class ApiGatewayIntegrationUtility:
614
617
  authorizer_name=authorizer_name,
615
618
  identity_source=identity_source,
616
619
  )
620
+
621
+ # The authorizer is automatically attached to the API Gateway when used in a method
622
+ # But we need to ensure it's created in the context of the API's scope
623
+ # The actual attachment happens when the authorizer is referenced in method creation
617
624
 
618
625
  return self.authorizer
619
626
 
@@ -61,35 +61,63 @@ class JsonLoadingUtility:
61
61
  """Resolve references in a configuration section."""
62
62
  if isinstance(section, dict):
63
63
  if self.nested_key in section:
64
- nested_path = str(section.pop(self.nested_key))
65
- # print(f"Resolving parent path: {nested_path}")
66
- if nested_path.endswith(".json"):
67
- nested_root_path = os.path.join(self.base_path, nested_path)
68
- nested_section = self.__load_json_file(nested_root_path)
69
- elif os.path.isdir(os.path.join(self.base_path, nested_path)):
70
- nested_section = []
71
- dir_path = os.path.join(self.base_path, nested_path)
72
- for filename in os.listdir(dir_path):
73
- if filename.endswith(".json"):
74
- file_path = os.path.join(dir_path, filename)
75
- # print(f"Loading file: {file_path}")
76
- file_section = self.__load_json_file(file_path)
77
- nested_section.append(file_section)
78
-
79
- # print("done with nested sections")
80
- else:
81
- nested_section = self.get_nested_config(root_config, nested_path)
82
-
83
- nested_section_resolved = self.resolve_references(
84
- nested_section, root_config
85
- )
86
- if len(section) > 0 and isinstance(nested_section_resolved, dict):
87
- nested_section_resolved.update(section)
88
- elif len(section) > 0 and isinstance(nested_section_resolved, list):
64
+ nested_paths = section.pop(self.nested_key)
65
+
66
+ # Support both single path (string) and multiple paths (list)
67
+ if isinstance(nested_paths, str):
68
+ nested_paths = [nested_paths]
69
+ elif not isinstance(nested_paths, list):
70
+ raise ValueError(f"__inherits__ must be a string or list, got {type(nested_paths)}")
71
+
72
+ # Process each path and merge results
73
+ merged_section = None
74
+
75
+ for nested_path in nested_paths:
76
+ nested_path = str(nested_path)
77
+ # print(f"Resolving parent path: {nested_path}")
78
+
79
+ if nested_path.endswith(".json"):
80
+ nested_root_path = os.path.join(self.base_path, nested_path)
81
+ nested_section = self.__load_json_file(nested_root_path)
82
+ elif os.path.isdir(os.path.join(self.base_path, nested_path)):
83
+ nested_section = []
84
+ dir_path = os.path.join(self.base_path, nested_path)
85
+ for filename in os.listdir(dir_path):
86
+ if filename.endswith(".json"):
87
+ file_path = os.path.join(dir_path, filename)
88
+ # print(f"Loading file: {file_path}")
89
+ file_section = self.__load_json_file(file_path)
90
+ nested_section.append(file_section)
91
+ # print("done with nested sections")
92
+ else:
93
+ nested_section = self.get_nested_config(root_config, nested_path)
94
+
95
+ nested_section_resolved = self.resolve_references(
96
+ nested_section, root_config
97
+ )
98
+
99
+ # Merge resolved sections
100
+ if merged_section is None:
101
+ merged_section = nested_section_resolved
102
+ else:
103
+ # Merge logic based on type
104
+ if isinstance(merged_section, dict) and isinstance(nested_section_resolved, dict):
105
+ self.merge_sections(merged_section, nested_section_resolved)
106
+ elif isinstance(merged_section, list) and isinstance(nested_section_resolved, list):
107
+ merged_section.extend(nested_section_resolved)
108
+ else:
109
+ raise RuntimeError(
110
+ f"Cannot merge incompatible types: {type(merged_section)} and {type(nested_section_resolved)}"
111
+ )
112
+
113
+ # Apply any additional properties from the section
114
+ if len(section) > 0 and isinstance(merged_section, dict):
115
+ merged_section.update(section)
116
+ elif len(section) > 0 and isinstance(merged_section, list):
89
117
  raise RuntimeError("we need to resolve this section")
90
- # nested_section_resolved.append(section)
118
+ # merged_section.append(section)
91
119
 
92
- section = nested_section_resolved
120
+ section = merged_section
93
121
 
94
122
  if isinstance(section, dict):
95
123
  for key, value in section.items():
@@ -0,0 +1 @@
1
+ __version__ = "0.8.2"
@@ -1 +0,0 @@
1
- __version__ = "0.8.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes