cdk-factory 0.15.3__tar.gz → 0.15.4__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 (158) hide show
  1. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/PKG-INFO +1 -1
  2. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/pyproject.toml +1 -1
  3. cdk_factory-0.15.4/scripts/cloudfront-cleanup.sh +220 -0
  4. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/cloudfront/cloudfront_distribution_construct.py +77 -0
  5. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/websites/static_website_stack.py +5 -0
  6. cdk_factory-0.15.4/src/cdk_factory/version.py +1 -0
  7. cdk_factory-0.15.3/src/cdk_factory/version.py +0 -1
  8. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/.gitignore +0 -0
  9. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/.windsurfrules +0 -0
  10. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/LICENSE +0 -0
  11. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/README.md +0 -0
  12. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/archive/README.md +0 -0
  13. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/archive/migrate_to_enhanced_ssm.py +0 -0
  14. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/examples/json-imports/README.md +0 -0
  15. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/examples/separate-api-gateway/README.md +0 -0
  16. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/examples/separate-api-gateway/api-gateway-stack.json +0 -0
  17. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/examples/separate-api-gateway/config.json +0 -0
  18. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/examples/separate-api-gateway/lambda-stack.json +0 -0
  19. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/mypy.ini +0 -0
  20. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/publish_to_pypi.py +0 -0
  21. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/publish_to_pypi.sh +0 -0
  22. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/pysetup.py +0 -0
  23. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/pysetup.sh +0 -0
  24. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/requirements.dev.txt +0 -0
  25. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/requirements.tests.txt +0 -0
  26. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/requirements.txt +0 -0
  27. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/run-checks.sh +0 -0
  28. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/run-tests-clean-venv.sh +0 -0
  29. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/run-tests.sh +0 -0
  30. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/__init__.py +0 -0
  31. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/app.py +0 -0
  32. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/builds/README.md +0 -0
  33. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/cdk.json +0 -0
  34. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/cli.py +0 -0
  35. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/commands/command_loader.py +0 -0
  36. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/base_config.py +0 -0
  37. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/cdk_config.py +0 -0
  38. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/deployment.py +0 -0
  39. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/deployment_wave.py +0 -0
  40. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/devops.py +0 -0
  41. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/enhanced_base_config.py +0 -0
  42. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/enhanced_ssm_config.py +0 -0
  43. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/management.py +0 -0
  44. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/pipeline.py +0 -0
  45. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/pipeline_stage.py +0 -0
  46. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/_resources.py +0 -0
  47. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/api_gateway.py +0 -0
  48. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/apigateway_route_config.py +0 -0
  49. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/auto_scaling.py +0 -0
  50. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/cloudfront.py +0 -0
  51. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/cloudwatch_widget.py +0 -0
  52. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/code_artifact.py +0 -0
  53. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/code_artifact_login.py +0 -0
  54. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/code_repository.py +0 -0
  55. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/cognito.py +0 -0
  56. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/docker.py +0 -0
  57. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/dynamodb.py +0 -0
  58. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/ecr.py +0 -0
  59. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/ecs_service.py +0 -0
  60. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/exisiting.py +0 -0
  61. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/lambda_edge.py +0 -0
  62. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/lambda_function.py +0 -0
  63. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/lambda_layers.py +0 -0
  64. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/lambda_triggers.py +0 -0
  65. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/load_balancer.py +0 -0
  66. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/monitoring.py +0 -0
  67. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/rds.py +0 -0
  68. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/resource_mapping.py +0 -0
  69. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/resource_naming.py +0 -0
  70. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/resource_types.py +0 -0
  71. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/route53.py +0 -0
  72. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/route53_hosted_zone.py +0 -0
  73. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/rum.py +0 -0
  74. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/s3.py +0 -0
  75. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/security_group.py +0 -0
  76. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/security_group_full_stack.py +0 -0
  77. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/sqs.py +0 -0
  78. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/resources/vpc.py +0 -0
  79. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/stack.py +0 -0
  80. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/configurations/workload.py +0 -0
  81. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/ecr/ecr_construct.py +0 -0
  82. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/lambdas/lambda_function_construct.py +0 -0
  83. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/lambdas/lambda_function_docker_construct.py +0 -0
  84. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/lambdas/lambda_function_role_construct.py +0 -0
  85. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/lambdas/policies/policy_docs.py +0 -0
  86. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/lambdas/policies/policy_statements.py +0 -0
  87. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/s3_buckets/s3_bucket_construct.py +0 -0
  88. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_destination_construct.py +0 -0
  89. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_source_construct.py +0 -0
  90. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/constructs/sqs/policies/sqs_policies.py +0 -0
  91. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/interfaces/enhanced_ssm_parameter_mixin.py +0 -0
  92. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/interfaces/istack.py +0 -0
  93. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/interfaces/live_ssm_resolver.py +0 -0
  94. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/interfaces/ssm_parameter_mixin.py +0 -0
  95. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/lambdas/edge/ip_gate/handler.py +0 -0
  96. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/lambdas/health_handler.py +0 -0
  97. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/pipeline/path_utils.py +0 -0
  98. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/pipeline/pipeline_factory.py +0 -0
  99. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/pipeline/security/policies.py +0 -0
  100. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/pipeline/security/roles.py +0 -0
  101. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/pipeline/stage.py +0 -0
  102. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack/istack.py +0 -0
  103. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack/stack_factory.py +0 -0
  104. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack/stack_module_loader.py +0 -0
  105. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack/stack_module_registry.py +0 -0
  106. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack/stack_modules.py +0 -0
  107. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/__init__.py +0 -0
  108. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/api_gateway/api_gateway_stack.py +0 -0
  109. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/auto_scaling/__init__.py +0 -0
  110. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/auto_scaling/auto_scaling_stack.py +0 -0
  111. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/aws_lambdas/lambda_stack.py +0 -0
  112. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/buckets/README.md +0 -0
  113. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/buckets/bucket_stack.py +0 -0
  114. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/cloudfront/__init__.py +0 -0
  115. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/cloudfront/cloudfront_stack.py +0 -0
  116. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/code_artifact/code_artifact_stack.py +0 -0
  117. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/cognito/cognito_stack.py +0 -0
  118. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py +0 -0
  119. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/ecr/README.md +0 -0
  120. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/ecr/ecr_stack.py +0 -0
  121. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/ecs/__init__.py +0 -0
  122. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/ecs/ecs_service_stack.py +0 -0
  123. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/lambda_edge/__init__.py +0 -0
  124. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/lambda_edge/lambda_edge_stack.py +0 -0
  125. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/load_balancer/__init__.py +0 -0
  126. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/load_balancer/load_balancer_stack.py +0 -0
  127. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/monitoring/__init__.py +0 -0
  128. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/monitoring/monitoring_stack.py +0 -0
  129. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/rds/__init__.py +0 -0
  130. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/rds/rds_stack.py +0 -0
  131. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/route53/__init__.py +0 -0
  132. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/route53/route53_stack.py +0 -0
  133. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/rum/__init__.py +0 -0
  134. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/rum/rum_stack.py +0 -0
  135. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/security_group/__init__.py +0 -0
  136. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/security_group/security_group_full_stack.py +0 -0
  137. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/security_group/security_group_stack.py +0 -0
  138. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/simple_queue_service/sqs_stack.py +0 -0
  139. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/stack_base.py +0 -0
  140. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/vpc/__init__.py +0 -0
  141. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stack_library/vpc/vpc_stack.py +0 -0
  142. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/stages/websites/static_website_stage.py +0 -0
  143. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/templates/README.md +0 -0
  144. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/templates/app.py.template +0 -0
  145. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/templates/cdk.json.template +0 -0
  146. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/api_gateway_integration_utility.py +0 -0
  147. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/commandline_args.py +0 -0
  148. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/configuration_loader.py +0 -0
  149. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/docker_utilities.py +0 -0
  150. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/environment_services.py +0 -0
  151. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/file_operations.py +0 -0
  152. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/git_utilities.py +0 -0
  153. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/json_loading_utility.py +0 -0
  154. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/lambda_function_utilities.py +0 -0
  155. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utilities/os_execute.py +0 -0
  156. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/utils/api_gateway_utilities.py +0 -0
  157. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/cdk_factory/workload/workload_factory.py +0 -0
  158. {cdk_factory-0.15.3 → cdk_factory-0.15.4}/src/handlers/test/handler.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdk_factory
3
- Version: 0.15.3
3
+ Version: 0.15.4
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
@@ -33,7 +33,7 @@ markers = [
33
33
  [project]
34
34
 
35
35
  name = "cdk_factory"
36
- version = "0.15.3"
36
+ version = "0.15.4"
37
37
  authors = [
38
38
  { name="Eric Wilson", email="eric.wilson@geekcafe.com" }
39
39
  ]
@@ -0,0 +1,220 @@
1
+ #!/bin/bash
2
+ #
3
+ # CloudFront Function Association Cleanup Script
4
+ #
5
+ # Use this when CDK deployments are stuck due to function association conflicts
6
+ # This script safely removes all function associations from a CloudFront distribution
7
+ #
8
+
9
+ set -e
10
+
11
+ # Colors for output
12
+ RED='\033[0;31m'
13
+ GREEN='\033[0;32m'
14
+ YELLOW='\033[1;33m'
15
+ NC='\033[0m' # No Color
16
+
17
+ # Usage
18
+ usage() {
19
+ echo "Usage: $0 --distribution-id <DIST_ID> [--profile <PROFILE>] [--dry-run]"
20
+ echo ""
21
+ echo "Options:"
22
+ echo " --distribution-id CloudFront distribution ID (required)"
23
+ echo " --profile AWS profile name (optional)"
24
+ echo " --dry-run Show what would be done without making changes"
25
+ echo " --help Show this help message"
26
+ echo ""
27
+ echo "Example:"
28
+ echo " $0 --distribution-id E3T9ODGTZTLF2N --profile gc-shared"
29
+ exit 1
30
+ }
31
+
32
+ # Parse arguments
33
+ DIST_ID=""
34
+ PROFILE=""
35
+ DRY_RUN=false
36
+
37
+ while [[ $# -gt 0 ]]; do
38
+ case $1 in
39
+ --distribution-id)
40
+ DIST_ID="$2"
41
+ shift 2
42
+ ;;
43
+ --profile)
44
+ PROFILE="$2"
45
+ shift 2
46
+ ;;
47
+ --dry-run)
48
+ DRY_RUN=true
49
+ shift
50
+ ;;
51
+ --help)
52
+ usage
53
+ ;;
54
+ *)
55
+ echo -e "${RED}Unknown option: $1${NC}"
56
+ usage
57
+ ;;
58
+ esac
59
+ done
60
+
61
+ # Validate required arguments
62
+ if [ -z "$DIST_ID" ]; then
63
+ echo -e "${RED}Error: --distribution-id is required${NC}"
64
+ usage
65
+ fi
66
+
67
+ # Build AWS CLI command prefix
68
+ AWS_CMD="aws cloudfront"
69
+ if [ -n "$PROFILE" ]; then
70
+ AWS_CMD="$AWS_CMD --profile $PROFILE"
71
+ fi
72
+
73
+ # Temp files
74
+ CONFIG_FILE="/tmp/cloudfront-config-${DIST_ID}.json"
75
+ CLEAN_CONFIG_FILE="/tmp/cloudfront-config-${DIST_ID}-clean.json"
76
+
77
+ echo -e "${YELLOW}========================================${NC}"
78
+ echo -e "${YELLOW}CloudFront Function Association Cleanup${NC}"
79
+ echo -e "${YELLOW}========================================${NC}"
80
+ echo ""
81
+ echo "Distribution ID: $DIST_ID"
82
+ if [ -n "$PROFILE" ]; then
83
+ echo "AWS Profile: $PROFILE"
84
+ fi
85
+ if [ "$DRY_RUN" = true ]; then
86
+ echo -e "${YELLOW}Mode: DRY RUN (no changes will be made)${NC}"
87
+ fi
88
+ echo ""
89
+
90
+ # Step 1: Get current configuration
91
+ echo -e "${GREEN}Step 1: Fetching current distribution configuration...${NC}"
92
+ $AWS_CMD get-distribution-config --id "$DIST_ID" > "$CONFIG_FILE"
93
+
94
+ if [ $? -ne 0 ]; then
95
+ echo -e "${RED}Error: Failed to get distribution configuration${NC}"
96
+ exit 1
97
+ fi
98
+
99
+ ETAG=$(cat "$CONFIG_FILE" | jq -r '.ETag')
100
+ echo "ETag: $ETAG"
101
+
102
+ # Step 2: Show current function associations
103
+ echo ""
104
+ echo -e "${GREEN}Step 2: Current function associations:${NC}"
105
+
106
+ LAMBDA_COUNT=$(cat "$CONFIG_FILE" | jq -r '.DistributionConfig.DefaultCacheBehavior.LambdaFunctionAssociations.Quantity // 0')
107
+ CF_FUNC_COUNT=$(cat "$CONFIG_FILE" | jq -r '.DistributionConfig.DefaultCacheBehavior.FunctionAssociations.Quantity // 0')
108
+
109
+ echo " Lambda@Edge functions: $LAMBDA_COUNT"
110
+ if [ "$LAMBDA_COUNT" -gt 0 ]; then
111
+ cat "$CONFIG_FILE" | jq -r '.DistributionConfig.DefaultCacheBehavior.LambdaFunctionAssociations.Items[]? | " - \(.EventType): \(.LambdaFunctionARN)"'
112
+ fi
113
+
114
+ echo " CloudFront Functions: $CF_FUNC_COUNT"
115
+ if [ "$CF_FUNC_COUNT" -gt 0 ]; then
116
+ cat "$CONFIG_FILE" | jq -r '.DistributionConfig.DefaultCacheBehavior.FunctionAssociations.Items[]? | " - \(.EventType): \(.FunctionARN)"'
117
+ fi
118
+
119
+ # Check if cleanup is needed
120
+ if [ "$LAMBDA_COUNT" -eq 0 ] && [ "$CF_FUNC_COUNT" -eq 0 ]; then
121
+ echo ""
122
+ echo -e "${GREEN}✓ No function associations found. Distribution is already clean!${NC}"
123
+ rm -f "$CONFIG_FILE"
124
+ exit 0
125
+ fi
126
+
127
+ # Step 3: Create cleaned configuration
128
+ echo ""
129
+ echo -e "${GREEN}Step 3: Creating cleaned configuration...${NC}"
130
+
131
+ cat "$CONFIG_FILE" | jq '
132
+ .DistributionConfig |
133
+ .DefaultCacheBehavior.FunctionAssociations = {"Quantity": 0} |
134
+ .DefaultCacheBehavior.LambdaFunctionAssociations = {"Quantity": 0}
135
+ ' > "$CLEAN_CONFIG_FILE"
136
+
137
+ echo " Cleaned config saved to: $CLEAN_CONFIG_FILE"
138
+
139
+ # Step 4: Apply changes
140
+ echo ""
141
+ if [ "$DRY_RUN" = true ]; then
142
+ echo -e "${YELLOW}Step 4: DRY RUN - Would remove all function associations${NC}"
143
+ echo ""
144
+ echo "To apply these changes, run without --dry-run:"
145
+ echo " $0 --distribution-id $DIST_ID $([ -n "$PROFILE" ] && echo "--profile $PROFILE")"
146
+
147
+ rm -f "$CONFIG_FILE" "$CLEAN_CONFIG_FILE"
148
+ exit 0
149
+ fi
150
+
151
+ echo -e "${GREEN}Step 4: Applying changes to CloudFront distribution...${NC}"
152
+ echo -e "${YELLOW}⚠️ This will remove ALL function associations from the distribution${NC}"
153
+ read -p "Are you sure you want to continue? (yes/no): " CONFIRM
154
+
155
+ if [ "$CONFIRM" != "yes" ]; then
156
+ echo "Aborted."
157
+ rm -f "$CONFIG_FILE" "$CLEAN_CONFIG_FILE"
158
+ exit 0
159
+ fi
160
+
161
+ $AWS_CMD update-distribution \
162
+ --id "$DIST_ID" \
163
+ --if-match "$ETAG" \
164
+ --distribution-config "file://$CLEAN_CONFIG_FILE" \
165
+ > /dev/null
166
+
167
+ if [ $? -ne 0 ]; then
168
+ echo -e "${RED}Error: Failed to update distribution${NC}"
169
+ rm -f "$CONFIG_FILE" "$CLEAN_CONFIG_FILE"
170
+ exit 1
171
+ fi
172
+
173
+ echo -e "${GREEN}✓ Successfully updated distribution${NC}"
174
+
175
+ # Step 5: Wait for deployment
176
+ echo ""
177
+ echo -e "${GREEN}Step 5: Waiting for distribution deployment...${NC}"
178
+ echo "This may take 5-10 minutes..."
179
+
180
+ $AWS_CMD wait distribution-deployed --id "$DIST_ID"
181
+
182
+ if [ $? -eq 0 ]; then
183
+ echo -e "${GREEN}✓ Distribution deployed successfully${NC}"
184
+ else
185
+ echo -e "${YELLOW}⚠️ Wait timed out or failed. Check distribution status manually.${NC}"
186
+ fi
187
+
188
+ # Step 6: Verify cleanup
189
+ echo ""
190
+ echo -e "${GREEN}Step 6: Verifying cleanup...${NC}"
191
+
192
+ $AWS_CMD get-distribution-config --id "$DIST_ID" > "$CONFIG_FILE"
193
+
194
+ LAMBDA_COUNT=$(cat "$CONFIG_FILE" | jq -r '.DistributionConfig.DefaultCacheBehavior.LambdaFunctionAssociations.Quantity // 0')
195
+ CF_FUNC_COUNT=$(cat "$CONFIG_FILE" | jq -r '.DistributionConfig.DefaultCacheBehavior.FunctionAssociations.Quantity // 0')
196
+
197
+ echo " Lambda@Edge functions: $LAMBDA_COUNT"
198
+ echo " CloudFront Functions: $CF_FUNC_COUNT"
199
+
200
+ if [ "$LAMBDA_COUNT" -eq 0 ] && [ "$CF_FUNC_COUNT" -eq 0 ]; then
201
+ echo ""
202
+ echo -e "${GREEN}========================================${NC}"
203
+ echo -e "${GREEN}✓ SUCCESS: All function associations removed${NC}"
204
+ echo -e "${GREEN}========================================${NC}"
205
+ echo ""
206
+ echo "Next steps:"
207
+ echo "1. Run your CDK deployment to add back desired functions"
208
+ echo "2. Wait 20-30 minutes for Lambda@Edge propagation (if using Lambda@Edge)"
209
+ echo "3. Test your CloudFront distribution"
210
+ else
211
+ echo ""
212
+ echo -e "${YELLOW}⚠️ Warning: Some functions still present${NC}"
213
+ echo "Manual verification may be needed."
214
+ fi
215
+
216
+ # Cleanup temp files
217
+ rm -f "$CONFIG_FILE" "$CLEAN_CONFIG_FILE"
218
+
219
+ echo ""
220
+ echo "Done!"
@@ -78,10 +78,87 @@ class CloudFrontDistributionConstruct(Construct):
78
78
  """
79
79
  return CloudFrontDistributionConstruct.AWS_HOSTED_ZONE_ID
80
80
 
81
+ def __validate_function_associations(self):
82
+ """
83
+ Validate CloudFront function association configuration.
84
+ Provides clear error messages for common misconfigurations.
85
+
86
+ CloudFront limits:
87
+ - 1 CloudFront Function (JavaScript) per event type
88
+ - 1 Lambda@Edge (Python/Node) per event type
89
+ - Different types CAN coexist at same event type
90
+ """
91
+ if not self.stack_config or not isinstance(self.stack_config, StackConfig):
92
+ return # No config to validate
93
+
94
+ cloudfront_config = self.stack_config.dictionary.get("cloudfront", {})
95
+
96
+ # Get configuration flags
97
+ enable_url_rewrite = cloudfront_config.get("enable_url_rewrite", False)
98
+ enable_ip_gating = cloudfront_config.get("enable_ip_gating", False)
99
+ restrict_to_known_hosts = cloudfront_config.get("restrict_to_known_hosts", self.restrict_to_known_hosts)
100
+
101
+ # Count CloudFront Functions at viewer-request
102
+ cloudfront_functions_at_viewer_request = 0
103
+ if enable_url_rewrite:
104
+ cloudfront_functions_at_viewer_request += 1
105
+ if restrict_to_known_hosts and self.aliases:
106
+ cloudfront_functions_at_viewer_request += 1
107
+
108
+ # Note: Multiple CloudFront Functions are OK - we combine them automatically
109
+ if cloudfront_functions_at_viewer_request > 1:
110
+ logger.info(
111
+ f"Multiple CloudFront Functions at viewer-request detected. "
112
+ f"Will combine into single function. "
113
+ f"Features: enable_url_rewrite={enable_url_rewrite}, "
114
+ f"restrict_to_known_hosts={restrict_to_known_hosts}"
115
+ )
116
+
117
+ # Check for manual Lambda@Edge associations that might conflict
118
+ lambda_edge_associations = cloudfront_config.get("lambda_edge_associations", [])
119
+ manual_viewer_request = any(
120
+ assoc.get("event_type") == "viewer-request"
121
+ for assoc in lambda_edge_associations
122
+ )
123
+
124
+ # ERROR: Manual Lambda@Edge + enable_ip_gating both at viewer-request
125
+ if enable_ip_gating and manual_viewer_request:
126
+ raise ValueError(
127
+ "Configuration conflict: Cannot use both 'enable_ip_gating: true' "
128
+ "and manual 'lambda_edge_associations' with 'event_type: viewer-request'. "
129
+ "\n\nSolution 1 (Recommended): Use only 'enable_ip_gating: true' "
130
+ "and remove manual lambda_edge_associations."
131
+ "\n\nSolution 2: Use only manual lambda_edge_associations "
132
+ "and set 'enable_ip_gating: false'."
133
+ "\n\nCurrent config:"
134
+ f"\n enable_ip_gating: {enable_ip_gating}"
135
+ f"\n lambda_edge_associations with viewer-request: {manual_viewer_request}"
136
+ )
137
+
138
+ # WARNING: Both Lambda@Edge IP gating and CloudFront Functions enabled
139
+ # This is VALID but might indicate misconfiguration
140
+ if enable_ip_gating and cloudfront_functions_at_viewer_request > 0:
141
+ features = []
142
+ if enable_url_rewrite:
143
+ features.append("URL rewrite")
144
+ if restrict_to_known_hosts:
145
+ features.append("Host restrictions")
146
+
147
+ logger.info(
148
+ f"✓ CloudFront configuration at viewer-request:"
149
+ f"\n - CloudFront Function: {', '.join(features)}"
150
+ f"\n - Lambda@Edge: IP gating"
151
+ f"\nThis is valid: CloudFront Functions and Lambda@Edge can coexist "
152
+ f"at the same event type."
153
+ )
154
+
81
155
  def __setup(self):
82
156
  """
83
157
  Any setup / init logic goes here
84
158
  """
159
+ # Validate CloudFront function association configuration
160
+ self.__validate_function_associations()
161
+
85
162
  self.oai = cloudfront.OriginAccessIdentity(
86
163
  self, "OAI", comment="OAI for accessing S3 bucket content securely"
87
164
  )
@@ -135,6 +135,10 @@ class StaticWebSiteStack(IStack):
135
135
  version = self.__get_version_number(assets_path)
136
136
  logger.info(f"👉 WEBSITE VERSION NUMBER: {version}")
137
137
 
138
+ # Get cloudfront config options
139
+ cloudfront_config = stack_config.dictionary.get("cloudfront", {})
140
+ restrict_to_known_hosts = cloudfront_config.get("restrict_to_known_hosts", True)
141
+
138
142
  cloudfront_distribution = CloudFrontDistributionConstruct(
139
143
  scope=self,
140
144
  id=deployment.build_resource_name("CloudFrontDistribution"),
@@ -142,6 +146,7 @@ class StaticWebSiteStack(IStack):
142
146
  aliases=aliases,
143
147
  source_bucket_sub_directory=version,
144
148
  certificate=certificate,
149
+ restrict_to_known_hosts=restrict_to_known_hosts,
145
150
  stack_config=stack_config,
146
151
  )
147
152
 
@@ -0,0 +1 @@
1
+ __version__ = "0.15.4"
@@ -1 +0,0 @@
1
- __version__ = "0.15.3"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes