cdk-factory 0.18.6__tar.gz → 0.18.9__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.
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/PKG-INFO +1 -1
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/pyproject.toml +1 -1
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/deployment.py +12 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/acm.py +9 -2
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/auto_scaling.py +2 -5
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/lambdas/policies/policy_docs.py +1 -1
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/interfaces/networked_stack_mixin.py +1 -1
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/interfaces/standardized_ssm_mixin.py +12 -10
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/api_gateway/api_gateway_stack.py +2 -2
- cdk_factory-0.18.6/src/cdk_factory/stack_library/auto_scaling/auto_scaling_stack_standardized.py → cdk_factory-0.18.9/src/cdk_factory/stack_library/auto_scaling/auto_scaling_stack.py +6 -4
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/cognito/cognito_stack.py +2 -2
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py +2 -2
- cdk_factory-0.18.9/src/cdk_factory/stack_library/ecs/__init__.py +12 -0
- cdk_factory-0.18.6/src/cdk_factory/stack_library/ecs/ecs_cluster_stack_standardized.py → cdk_factory-0.18.9/src/cdk_factory/stack_library/ecs/ecs_cluster_stack.py +13 -31
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/load_balancer/load_balancer_stack.py +58 -59
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/rds/rds_stack.py +2 -2
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/rum/rum_stack.py +3 -3
- cdk_factory-0.18.6/src/cdk_factory/stack_library/vpc/vpc_stack_standardized.py → cdk_factory-0.18.9/src/cdk_factory/stack_library/vpc/vpc_stack.py +14 -10
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/websites/static_website_stack.py +1 -1
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/api_gateway_integration_utility.py +2 -2
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/environment_services.py +2 -2
- cdk_factory-0.18.9/src/cdk_factory/version.py +1 -0
- cdk_factory-0.18.6/src/cdk_factory/stack_library/ecs/__init__.py +0 -14
- cdk_factory-0.18.6/src/cdk_factory/version.py +0 -1
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/.gitignore +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/.windsurfrules +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/LICENSE +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/REFACTORING_PLAN.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/archive/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/archive/migrate_to_enhanced_ssm.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/examples/json-imports/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/examples/separate-api-gateway/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/examples/separate-api-gateway/api-gateway-stack.json +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/examples/separate-api-gateway/config.json +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/examples/separate-api-gateway/lambda-stack.json +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/mypy.ini +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/publish_to_pypi.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/publish_to_pypi.sh +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/pysetup.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/pysetup.sh +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/requirements.dev.txt +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/requirements.tests.txt +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/requirements.txt +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/run-checks.sh +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/run-tests-clean-venv.sh +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/run-tests.sh +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/scripts/cloudfront-cleanup.sh +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/app.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/builds/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/cdk.json +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/cli.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/commands/command_loader.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/base_config.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/cdk_config.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/deployment_wave.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/devops.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/enhanced_base_config.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/enhanced_ssm_config.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/management.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/pipeline.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/pipeline_stage.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/_resources.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/api_gateway.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/apigateway_route_config.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/cloudfront.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/cloudwatch_widget.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/code_artifact.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/code_artifact_login.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/code_repository.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/cognito.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/docker.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/dynamodb.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/ecr.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/ecs_cluster.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/ecs_service.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/exisiting.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/lambda_edge.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/lambda_function.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/lambda_layers.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/lambda_triggers.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/load_balancer.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/monitoring.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/rds.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/resource_mapping.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/resource_naming.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/resource_types.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/route53.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/route53_hosted_zone.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/rum.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/s3.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/security_group.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/security_group_full_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/sqs.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/vpc.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/workload.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/cloudfront/cloudfront_distribution_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/ecr/ecr_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/lambdas/lambda_function_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/lambdas/lambda_function_docker_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/lambdas/lambda_function_role_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/lambdas/policies/policy_statements.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/s3_buckets/s3_bucket_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_destination_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_source_construct.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/sqs/policies/sqs_policies.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/interfaces/istack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/interfaces/live_ssm_resolver.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/interfaces/vpc_provider_mixin.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/lambdas/edge/ip_gate/handler.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/lambdas/health_handler.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/pipeline/path_utils.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/pipeline/pipeline_factory.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/pipeline/security/policies.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/pipeline/security/roles.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/pipeline/stage.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack/istack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack/stack_factory.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack/stack_module_loader.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack/stack_module_registry.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack/stack_modules.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/acm/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/acm/acm_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/auto_scaling/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/aws_lambdas/lambda_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/buckets/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/buckets/bucket_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/cloudfront/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/cloudfront/cloudfront_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/code_artifact/code_artifact_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/ecr/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/ecr/ecr_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/ecs/ecs_service_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/lambda_edge/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/lambda_edge/lambda_edge_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/load_balancer/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/monitoring/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/monitoring/monitoring_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/rds/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/route53/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/route53/route53_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/rum/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/security_group/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/security_group/security_group_full_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/security_group/security_group_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/simple_queue_service/sqs_stack.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/stack_base.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/vpc/__init__.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stages/websites/static_website_stage.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/templates/README.md +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/templates/app.py.template +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/templates/cdk.json.template +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/commandline_args.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/configuration_loader.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/docker_utilities.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/file_operations.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/git_utilities.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/json_loading_utility.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/lambda_function_utilities.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utilities/os_execute.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/utils/api_gateway_utilities.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/validation/config_validator.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/workload/workload_factory.py +0 -0
- {cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/handlers/test/handler.py +0 -0
|
@@ -28,6 +28,18 @@ class DeploymentConfig:
|
|
|
28
28
|
self.__load()
|
|
29
29
|
|
|
30
30
|
def __load(self):
|
|
31
|
+
# Validate environment consistency
|
|
32
|
+
deployment_env = self.__deployment.get("environment")
|
|
33
|
+
workload_env = self.__workload.get("environment")
|
|
34
|
+
|
|
35
|
+
if deployment_env and workload_env and deployment_env != workload_env:
|
|
36
|
+
from aws_lambda_powertools import Logger
|
|
37
|
+
logger = Logger()
|
|
38
|
+
logger.warning(
|
|
39
|
+
f"Environment mismatch: deployment.environment='{deployment_env}' != workload.environment='{workload_env}'. "
|
|
40
|
+
f"Using workload.environment for consistency."
|
|
41
|
+
)
|
|
42
|
+
|
|
31
43
|
self.__load_pipeline()
|
|
32
44
|
self.__load_stacks()
|
|
33
45
|
|
|
@@ -59,15 +59,22 @@ class AcmConfig:
|
|
|
59
59
|
"""Certificate transparency logging preference (ENABLED or DISABLED)"""
|
|
60
60
|
return self.__config.get("certificate_transparency_logging_preference")
|
|
61
61
|
|
|
62
|
+
@property
|
|
63
|
+
def ssm(self) -> Dict[str, Any]:
|
|
64
|
+
"""SSM configuration for importing/exporting resources"""
|
|
65
|
+
return self.__config.get("ssm", {})
|
|
66
|
+
|
|
62
67
|
@property
|
|
63
68
|
def ssm_exports(self) -> Dict[str, str]:
|
|
64
69
|
"""SSM parameter paths to export certificate details"""
|
|
65
|
-
exports = self.
|
|
70
|
+
exports = self.ssm.get("exports", {})
|
|
66
71
|
|
|
67
72
|
# Provide default SSM export path if not specified
|
|
68
73
|
if not exports and self.__deployment:
|
|
74
|
+
workload_env = self.__deployment.workload.get("environment", self.__deployment.environment)
|
|
75
|
+
workload_name = self.__deployment.workload.get("name", self.__deployment.workload_name)
|
|
69
76
|
exports = {
|
|
70
|
-
"certificate_arn": f"/{
|
|
77
|
+
"certificate_arn": f"/{workload_env}/{workload_name}/certificate/arn"
|
|
71
78
|
}
|
|
72
79
|
|
|
73
80
|
return exports
|
{cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/configurations/resources/auto_scaling.py
RENAMED
|
@@ -70,12 +70,9 @@ class AutoScalingConfig(EnhancedBaseConfig):
|
|
|
70
70
|
return self.__config.get("termination_policies", ["DEFAULT"])
|
|
71
71
|
|
|
72
72
|
@property
|
|
73
|
-
def update_policy(self) -> Dict[str, Any]:
|
|
73
|
+
def update_policy(self) -> Optional[Dict[str, Any]]:
|
|
74
74
|
"""Update policy configuration"""
|
|
75
|
-
return self.__config.get(
|
|
76
|
-
"update_policy",
|
|
77
|
-
{"min_instances_in_service": 1, "max_batch_size": 1, "pause_time": 300},
|
|
78
|
-
)
|
|
75
|
+
return self.__config.get("update_policy")
|
|
79
76
|
|
|
80
77
|
@property
|
|
81
78
|
def user_data_commands(self) -> List[str]:
|
{cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/constructs/lambdas/policies/policy_docs.py
RENAMED
|
@@ -46,7 +46,7 @@ class ResourceResolver:
|
|
|
46
46
|
ssm_config = lambda_dict.get("ssm", {})
|
|
47
47
|
|
|
48
48
|
if ssm_config.get("enabled", False):
|
|
49
|
-
self._ssm_mixin.
|
|
49
|
+
self._ssm_mixin.setup_ssm_integration(
|
|
50
50
|
scope=self.scope,
|
|
51
51
|
config=lambda_dict,
|
|
52
52
|
resource_type="lambda",
|
{cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/interfaces/networked_stack_mixin.py
RENAMED
|
@@ -26,7 +26,7 @@ class NetworkedStackMixin(StandardizedSsmMixin, VPCProviderMixin):
|
|
|
26
26
|
# SSM initialization is handled automatically by StandardizedSsmMixin.__init__
|
|
27
27
|
|
|
28
28
|
def _build(self, stack_config, deployment, workload):
|
|
29
|
-
self.
|
|
29
|
+
self.setup_ssm_integration(scope=self, config=stack_config.dictionary, resource_type="my-resource", resource_name="my-name")
|
|
30
30
|
self.vpc = self.resolve_vpc(stack_config, deployment, workload)
|
|
31
31
|
"""
|
|
32
32
|
|
{cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/interfaces/standardized_ssm_mixin.py
RENAMED
|
@@ -153,7 +153,7 @@ class StandardizedSsmMixin:
|
|
|
153
153
|
normalized = normalized.strip('-')
|
|
154
154
|
return normalized
|
|
155
155
|
|
|
156
|
-
def
|
|
156
|
+
def setup_ssm_integration(
|
|
157
157
|
self,
|
|
158
158
|
scope: Construct,
|
|
159
159
|
config: Any,
|
|
@@ -202,7 +202,7 @@ class StandardizedSsmMixin:
|
|
|
202
202
|
logger.info(f"SSM imports: {len(self.ssm_config.get('imports', {}))}")
|
|
203
203
|
logger.info(f"SSM exports: {len(self.ssm_config.get('exports', {}))}")
|
|
204
204
|
|
|
205
|
-
def
|
|
205
|
+
def process_ssm_imports(self) -> None:
|
|
206
206
|
"""
|
|
207
207
|
Process SSM imports using standardized approach.
|
|
208
208
|
|
|
@@ -230,7 +230,7 @@ class StandardizedSsmMixin:
|
|
|
230
230
|
logger.error(error_msg)
|
|
231
231
|
raise ValueError(error_msg)
|
|
232
232
|
|
|
233
|
-
def
|
|
233
|
+
def export_ssm_parameters(self, resource_values: Dict[str, Any]) -> Dict[str, str]:
|
|
234
234
|
"""
|
|
235
235
|
Export SSM parameters using standardized approach.
|
|
236
236
|
|
|
@@ -338,16 +338,18 @@ class StandardizedSsmMixin:
|
|
|
338
338
|
# Prepare template variables
|
|
339
339
|
variables = {}
|
|
340
340
|
|
|
341
|
-
|
|
341
|
+
# Always prioritize workload environment for consistency
|
|
342
|
+
if self.workload:
|
|
343
|
+
variables["ENVIRONMENT"] = self.workload.dictionary.get("environment", "test")
|
|
344
|
+
variables["WORKLOAD_NAME"] = self.workload.dictionary.get("name", "test-workload")
|
|
345
|
+
variables["AWS_REGION"] = os.getenv("AWS_REGION", "us-east-1")
|
|
346
|
+
elif self.deployment:
|
|
347
|
+
# Fallback to deployment only if workload not available
|
|
342
348
|
variables["ENVIRONMENT"] = self.deployment.environment
|
|
343
349
|
variables["WORKLOAD_NAME"] = self.deployment.workload_name
|
|
344
350
|
variables["AWS_REGION"] = getattr(self.deployment, 'region', None) or os.getenv("AWS_REGION", "us-east-1")
|
|
345
|
-
elif self.workload:
|
|
346
|
-
variables["ENVIRONMENT"] = getattr(self.workload, 'environment', 'test')
|
|
347
|
-
variables["WORKLOAD_NAME"] = getattr(self.workload, 'name', 'test-workload')
|
|
348
|
-
variables["AWS_REGION"] = os.getenv("AWS_REGION", "us-east-1")
|
|
349
351
|
else:
|
|
350
|
-
#
|
|
352
|
+
# Final fallback to environment variables
|
|
351
353
|
variables["ENVIRONMENT"] = os.getenv("ENVIRONMENT", "test")
|
|
352
354
|
variables["WORKLOAD_NAME"] = os.getenv("WORKLOAD_NAME", "test-workload")
|
|
353
355
|
variables["AWS_REGION"] = os.getenv("AWS_REGION", "us-east-1")
|
|
@@ -398,7 +400,7 @@ class StandardizedSsmMixin:
|
|
|
398
400
|
resource_type = segments[3]
|
|
399
401
|
|
|
400
402
|
# Check for valid environment patterns
|
|
401
|
-
if environment not in ["dev", "staging", "prod", "test"]:
|
|
403
|
+
if environment not in ["dev", "staging", "prod", "test", "alpha", "beta", "sandbox"]:
|
|
402
404
|
logger.warning(f"{context}: Unusual environment segment: {environment}")
|
|
403
405
|
|
|
404
406
|
# Check for valid resource type patterns
|
|
@@ -744,7 +744,7 @@ class ApiGatewayStack(IStack, StandardizedSsmMixin):
|
|
|
744
744
|
# Setup enhanced SSM integration with proper resource type and name
|
|
745
745
|
api_name = self.api_config.name or "api-gateway"
|
|
746
746
|
|
|
747
|
-
self.
|
|
747
|
+
self.setup_ssm_integration(
|
|
748
748
|
scope=self,
|
|
749
749
|
config=self.stack_config.dictionary.get("api_gateway", {}),
|
|
750
750
|
resource_type="api-gateway",
|
|
@@ -775,7 +775,7 @@ class ApiGatewayStack(IStack, StandardizedSsmMixin):
|
|
|
775
775
|
resource_values["authorizer_id"] = authorizer.authorizer_id
|
|
776
776
|
|
|
777
777
|
# Use enhanced SSM parameter export
|
|
778
|
-
exported_params = self.
|
|
778
|
+
exported_params = self.export_ssm_parameters(resource_values)
|
|
779
779
|
|
|
780
780
|
if exported_params:
|
|
781
781
|
logger.info(
|
|
@@ -92,7 +92,7 @@ class AutoScalingStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
92
92
|
asg_name = deployment.build_resource_name(self.asg_config.name)
|
|
93
93
|
|
|
94
94
|
# Setup standardized SSM integration
|
|
95
|
-
self.
|
|
95
|
+
self.setup_ssm_integration(
|
|
96
96
|
scope=self,
|
|
97
97
|
config=self.asg_config,
|
|
98
98
|
resource_type="auto_scaling",
|
|
@@ -102,7 +102,7 @@ class AutoScalingStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
102
102
|
)
|
|
103
103
|
|
|
104
104
|
# Process SSM imports using standardized method
|
|
105
|
-
self.
|
|
105
|
+
self.process_ssm_imports()
|
|
106
106
|
|
|
107
107
|
# Get security groups using standardized approach
|
|
108
108
|
self.security_groups = self._get_security_groups()
|
|
@@ -358,7 +358,8 @@ class AutoScalingStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
358
358
|
elif self.asg_config.ami_type.upper() == "AMAZON-LINUX-2":
|
|
359
359
|
machine_image = ec2.MachineImage.latest_amazon_linux2()
|
|
360
360
|
elif self.asg_config.ami_type.upper() == "ECS_OPTIMIZED":
|
|
361
|
-
|
|
361
|
+
# Use actual ECS-optimized AMI (Amazon Linux 2 based)
|
|
362
|
+
machine_image = ec2.MachineImage.lookup(name="amzn2-ami-ecs-hvm-*-x86_64-ebs")
|
|
362
363
|
else:
|
|
363
364
|
# Default to latest Amazon Linux
|
|
364
365
|
machine_image = ec2.MachineImage.latest_amazon_linux2023()
|
|
@@ -483,6 +484,7 @@ class AutoScalingStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
483
484
|
update_policy = self.asg_config.update_policy
|
|
484
485
|
|
|
485
486
|
if not update_policy:
|
|
487
|
+
# No update policy configured, don't add one
|
|
486
488
|
return
|
|
487
489
|
|
|
488
490
|
# Get the underlying CloudFormation resource to add update policy
|
|
@@ -519,7 +521,7 @@ class AutoScalingStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
519
521
|
}
|
|
520
522
|
|
|
521
523
|
# Export using standardized SSM mixin
|
|
522
|
-
exported_params = self.
|
|
524
|
+
exported_params = self.export_ssm_parameters(resource_values)
|
|
523
525
|
|
|
524
526
|
logger.info(f"Exported SSM parameters: {exported_params}")
|
|
525
527
|
|
{cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/cognito/cognito_stack.py
RENAMED
|
@@ -564,7 +564,7 @@ class CognitoStack(IStack, StandardizedSsmMixin):
|
|
|
564
564
|
# Setup enhanced SSM integration with proper resource type and name
|
|
565
565
|
# Use "user-pool" as resource identifier for SSM paths, not the full pool name
|
|
566
566
|
|
|
567
|
-
self.
|
|
567
|
+
self.setup_ssm_integration(
|
|
568
568
|
scope=self,
|
|
569
569
|
config=self.stack_config.dictionary.get("cognito", {}),
|
|
570
570
|
resource_type="cognito",
|
|
@@ -591,7 +591,7 @@ class CognitoStack(IStack, StandardizedSsmMixin):
|
|
|
591
591
|
# or retrieve via AWS Console/CLI if needed.
|
|
592
592
|
|
|
593
593
|
# Use enhanced SSM parameter export
|
|
594
|
-
exported_params = self.
|
|
594
|
+
exported_params = self.export_ssm_parameters(resource_values)
|
|
595
595
|
|
|
596
596
|
if exported_params:
|
|
597
597
|
logger.info(f"Exported {len(exported_params)} Cognito parameters to SSM")
|
{cdk_factory-0.18.6 → cdk_factory-0.18.9}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py
RENAMED
|
@@ -152,7 +152,7 @@ class DynamoDBStack(IStack, StandardizedSsmMixin):
|
|
|
152
152
|
# Setup enhanced SSM integration with proper resource type and name
|
|
153
153
|
# Use "app-table" as resource identifier for SSM paths, not the full table name
|
|
154
154
|
|
|
155
|
-
self.
|
|
155
|
+
self.setup_ssm_integration(
|
|
156
156
|
scope=self,
|
|
157
157
|
config=self.stack_config.dictionary.get("dynamodb", {}),
|
|
158
158
|
resource_type="dynamodb",
|
|
@@ -178,7 +178,7 @@ class DynamoDBStack(IStack, StandardizedSsmMixin):
|
|
|
178
178
|
resource_values = {k: v for k, v in resource_values.items() if v is not None}
|
|
179
179
|
|
|
180
180
|
# Use enhanced SSM parameter export
|
|
181
|
-
exported_params = self.
|
|
181
|
+
exported_params = self.export_ssm_parameters(resource_values)
|
|
182
182
|
|
|
183
183
|
if exported_params:
|
|
184
184
|
logger.info(f"Exported {len(exported_params)} DynamoDB parameters to SSM")
|
|
@@ -86,17 +86,20 @@ class EcsClusterStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
86
86
|
# Initialize VPC cache from mixin
|
|
87
87
|
self._initialize_vpc_cache()
|
|
88
88
|
|
|
89
|
-
# Load ECS cluster configuration
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
# Load ECS cluster configuration with full stack config for SSM access
|
|
90
|
+
ecs_cluster_dict = stack_config.dictionary.get("ecs_cluster", {})
|
|
91
|
+
# Merge SSM config from root level into ECS config for VPC resolution
|
|
92
|
+
if "ssm" in stack_config.dictionary:
|
|
93
|
+
ecs_cluster_dict["ssm"] = stack_config.dictionary["ssm"]
|
|
94
|
+
|
|
95
|
+
self.ecs_config: EcsClusterConfig = EcsClusterConfig(ecs_cluster_dict)
|
|
93
96
|
|
|
94
97
|
cluster_name = deployment.build_resource_name(self.ecs_config.name)
|
|
95
98
|
|
|
96
99
|
logger.info(f"Creating ECS Cluster stack: {cluster_name}")
|
|
97
100
|
|
|
98
101
|
# Setup standardized SSM integration
|
|
99
|
-
self.
|
|
102
|
+
self.setup_ssm_integration(
|
|
100
103
|
scope=self,
|
|
101
104
|
config=self.ecs_config,
|
|
102
105
|
resource_type="ecs_cluster",
|
|
@@ -106,7 +109,7 @@ class EcsClusterStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
106
109
|
)
|
|
107
110
|
|
|
108
111
|
# Process SSM imports using standardized method
|
|
109
|
-
self.
|
|
112
|
+
self.process_ssm_imports()
|
|
110
113
|
|
|
111
114
|
# Create the ECS cluster
|
|
112
115
|
self._create_ecs_cluster()
|
|
@@ -167,7 +170,8 @@ class EcsClusterStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
167
170
|
"""
|
|
168
171
|
Get VPC using the centralized VPC provider mixin.
|
|
169
172
|
"""
|
|
170
|
-
|
|
173
|
+
|
|
174
|
+
# Use the stack_config (not ecs_config) to ensure SSM imports are available
|
|
171
175
|
return self.resolve_vpc(
|
|
172
176
|
config=self.ecs_config,
|
|
173
177
|
deployment=self.deployment,
|
|
@@ -302,33 +306,11 @@ class EcsClusterStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
302
306
|
logger.info(f" {key}: {value}")
|
|
303
307
|
|
|
304
308
|
try:
|
|
305
|
-
exported_params = self.
|
|
309
|
+
exported_params = self.export_ssm_parameters(resource_values)
|
|
306
310
|
logger.info(f"Successfully exported SSM parameters: {exported_params}")
|
|
307
311
|
except Exception as e:
|
|
308
312
|
logger.error(f"Failed to export SSM parameters: {str(e)}")
|
|
309
313
|
raise
|
|
310
314
|
|
|
311
|
-
# Backward compatibility
|
|
312
|
-
def process_ssm_imports(self, config: Any, deployment: DeploymentConfig, resource_type: str = "resource") -> None:
|
|
313
|
-
"""Backward compatibility method for existing modules."""
|
|
314
|
-
# Extract SSM configuration from old format
|
|
315
|
-
if hasattr(config, 'ssm_imports'):
|
|
316
|
-
# Convert old ssm_imports format to new format
|
|
317
|
-
old_imports = config.ssm_imports
|
|
318
|
-
new_imports = {}
|
|
319
|
-
|
|
320
|
-
for key, value in old_imports.items():
|
|
321
|
-
# Resolve template variables using old method
|
|
322
|
-
if isinstance(value, str) and not value.startswith('/'):
|
|
323
|
-
value = f"/{deployment.environment}/{deployment.workload_name}/{value}"
|
|
324
|
-
new_imports[key] = value
|
|
325
|
-
|
|
326
|
-
# Update SSM config
|
|
327
|
-
self.ssm_config = {"imports": new_imports}
|
|
328
|
-
|
|
329
|
-
# Process imports using standardized method
|
|
330
|
-
self.process_standardized_ssm_imports()
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
# Backward compatibility alias
|
|
315
|
+
# Backward compatibility alias
|
|
334
316
|
EcsClusterStackStandardized = EcsClusterStack
|
|
@@ -6,6 +6,8 @@ MIT License. See Project Root for the license information.
|
|
|
6
6
|
|
|
7
7
|
from typing import Dict, Any, List, Optional
|
|
8
8
|
|
|
9
|
+
import base64
|
|
10
|
+
import hashlib
|
|
9
11
|
import aws_cdk as cdk
|
|
10
12
|
from aws_cdk import aws_elasticloadbalancingv2 as elbv2
|
|
11
13
|
from aws_cdk import aws_ec2 as ec2
|
|
@@ -50,7 +52,7 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
50
52
|
self._hosted_zone = None
|
|
51
53
|
self._record_names = None
|
|
52
54
|
# SSM imported values
|
|
53
|
-
self.
|
|
55
|
+
self._ssm_imported_values: Dict[str, str] = {}
|
|
54
56
|
|
|
55
57
|
def build(
|
|
56
58
|
self,
|
|
@@ -77,8 +79,18 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
77
79
|
)
|
|
78
80
|
lb_name = deployment.build_resource_name(self.lb_config.name)
|
|
79
81
|
|
|
80
|
-
#
|
|
81
|
-
self.
|
|
82
|
+
# Setup standardized SSM integration
|
|
83
|
+
self.setup_ssm_integration(
|
|
84
|
+
scope=self,
|
|
85
|
+
config=self.lb_config,
|
|
86
|
+
resource_type="load_balancer",
|
|
87
|
+
resource_name=self.lb_config.name,
|
|
88
|
+
deployment=deployment,
|
|
89
|
+
workload=workload
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Process SSM imports
|
|
93
|
+
self.process_ssm_imports()
|
|
82
94
|
|
|
83
95
|
self._prep_dns()
|
|
84
96
|
|
|
@@ -193,63 +205,13 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
193
205
|
)
|
|
194
206
|
return self._vpc
|
|
195
207
|
|
|
196
|
-
def _process_ssm_imports(self) -> None:
|
|
197
|
-
"""
|
|
198
|
-
Process SSM imports from configuration.
|
|
199
|
-
Follows the same pattern as RDS and Security Group stacks.
|
|
200
|
-
"""
|
|
201
|
-
from aws_cdk import aws_ssm as ssm
|
|
202
|
-
|
|
203
|
-
ssm_imports = self.lb_config.ssm_imports
|
|
204
|
-
|
|
205
|
-
if not ssm_imports:
|
|
206
|
-
logger.debug("No SSM imports configured for Load Balancer")
|
|
207
|
-
return
|
|
208
|
-
|
|
209
|
-
logger.info(f"Processing {len(ssm_imports)} SSM imports for Load Balancer")
|
|
210
|
-
|
|
211
|
-
for param_key, param_value in ssm_imports.items():
|
|
212
|
-
try:
|
|
213
|
-
# Handle list values (like security_groups)
|
|
214
|
-
if isinstance(param_value, list):
|
|
215
|
-
imported_list = []
|
|
216
|
-
for idx, param_path in enumerate(param_value):
|
|
217
|
-
if not param_path.startswith('/'):
|
|
218
|
-
param_path = f"/{param_path}"
|
|
219
|
-
|
|
220
|
-
construct_id = f"ssm-import-{param_key}-{idx}-{hash(param_path) % 10000}"
|
|
221
|
-
param = ssm.StringParameter.from_string_parameter_name(
|
|
222
|
-
self, construct_id, param_path
|
|
223
|
-
)
|
|
224
|
-
imported_list.append(param.string_value)
|
|
225
|
-
|
|
226
|
-
self.ssm_imported_values[param_key] = imported_list
|
|
227
|
-
logger.info(f"Imported SSM parameter list: {param_key} with {len(imported_list)} items")
|
|
228
|
-
else:
|
|
229
|
-
# Handle string values
|
|
230
|
-
param_path = param_value
|
|
231
|
-
if not param_path.startswith('/'):
|
|
232
|
-
param_path = f"/{param_path}"
|
|
233
|
-
|
|
234
|
-
construct_id = f"ssm-import-{param_key}-{hash(param_path) % 10000}"
|
|
235
|
-
param = ssm.StringParameter.from_string_parameter_name(
|
|
236
|
-
self, construct_id, param_path
|
|
237
|
-
)
|
|
238
|
-
|
|
239
|
-
self.ssm_imported_values[param_key] = param.string_value
|
|
240
|
-
logger.info(f"Imported SSM parameter: {param_key} from {param_path}")
|
|
241
|
-
|
|
242
|
-
except Exception as e:
|
|
243
|
-
logger.error(f"Failed to import SSM parameter {param_key}: {e}")
|
|
244
|
-
raise
|
|
245
|
-
|
|
246
208
|
def _get_security_groups(self) -> List[ec2.ISecurityGroup]:
|
|
247
209
|
"""Get security groups for the Load Balancer"""
|
|
248
210
|
security_groups = []
|
|
249
211
|
|
|
250
212
|
# Check SSM imported values first
|
|
251
|
-
if "security_groups" in self.
|
|
252
|
-
sg_ids = self.
|
|
213
|
+
if "security_groups" in self._ssm_imported_values:
|
|
214
|
+
sg_ids = self._ssm_imported_values["security_groups"]
|
|
253
215
|
if not isinstance(sg_ids, list):
|
|
254
216
|
sg_ids = [sg_ids]
|
|
255
217
|
else:
|
|
@@ -293,6 +255,32 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
293
255
|
)
|
|
294
256
|
return subnets
|
|
295
257
|
|
|
258
|
+
def _generate_target_group_name(self, lb_name: str, tg_name: str, max_length: int = 32) -> str:
|
|
259
|
+
"""Generate a unique target group name that doesn't begin/end with hyphens"""
|
|
260
|
+
full_name = f"{lb_name}-{tg_name}"
|
|
261
|
+
|
|
262
|
+
if len(full_name) <= max_length:
|
|
263
|
+
# No truncation needed, just ensure no leading/trailing hyphens
|
|
264
|
+
return full_name.strip('-')
|
|
265
|
+
|
|
266
|
+
# Need to truncate - use hash suffix for uniqueness
|
|
267
|
+
# Reserve space for hash (typically 8 chars) and separator
|
|
268
|
+
hash_length = 8
|
|
269
|
+
separator_length = 1
|
|
270
|
+
max_name_length = max_length - hash_length - separator_length
|
|
271
|
+
|
|
272
|
+
# Take the prefix and ensure it doesn't end with hyphen
|
|
273
|
+
prefix = full_name[:max_name_length].rstrip('-')
|
|
274
|
+
|
|
275
|
+
# Generate hash of the full name for uniqueness
|
|
276
|
+
hash_bytes = hashlib.sha256(full_name.encode()).digest()
|
|
277
|
+
hash_suffix = base64.urlsafe_b64encode(hash_bytes).decode()[:hash_length]
|
|
278
|
+
|
|
279
|
+
# Ensure hash doesn't start with hyphen (replace any non-alphanumeric chars)
|
|
280
|
+
hash_suffix = ''.join(c for c in hash_suffix if c.isalnum())[:hash_length]
|
|
281
|
+
|
|
282
|
+
return f"{prefix}-{hash_suffix}"
|
|
283
|
+
|
|
296
284
|
def _create_target_groups(self, lb_name: str) -> None:
|
|
297
285
|
"""Create target groups for the Load Balancer"""
|
|
298
286
|
|
|
@@ -300,6 +288,9 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
300
288
|
tg_name = tg_config.get("name", f"tg-{idx}")
|
|
301
289
|
tg_id = f"{lb_name}-{tg_name}"
|
|
302
290
|
|
|
291
|
+
# Generate a unique target group name that doesn't begin/end with hyphens
|
|
292
|
+
tg_name_sanitized = self._generate_target_group_name(lb_name, tg_name)
|
|
293
|
+
|
|
303
294
|
# Configure health check
|
|
304
295
|
health_check = self._configure_health_check(
|
|
305
296
|
tg_config.get("health_check", {})
|
|
@@ -310,7 +301,7 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
310
301
|
target_group = elbv2.ApplicationTargetGroup(
|
|
311
302
|
self,
|
|
312
303
|
tg_id,
|
|
313
|
-
target_group_name=
|
|
304
|
+
target_group_name=tg_name_sanitized,
|
|
314
305
|
vpc=self.vpc,
|
|
315
306
|
port=tg_config.get("port", 80),
|
|
316
307
|
protocol=elbv2.ApplicationProtocol(
|
|
@@ -325,7 +316,7 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
325
316
|
target_group = elbv2.NetworkTargetGroup(
|
|
326
317
|
self,
|
|
327
318
|
tg_id,
|
|
328
|
-
target_group_name=
|
|
319
|
+
target_group_name=tg_name_sanitized,
|
|
329
320
|
vpc=self.vpc,
|
|
330
321
|
port=tg_config.get("port", 80),
|
|
331
322
|
protocol=elbv2.Protocol(tg_config.get("protocol", "TCP")),
|
|
@@ -335,6 +326,8 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
335
326
|
health_check=health_check,
|
|
336
327
|
)
|
|
337
328
|
|
|
329
|
+
|
|
330
|
+
|
|
338
331
|
# Store target group for later use
|
|
339
332
|
self.target_groups[tg_name] = target_group
|
|
340
333
|
|
|
@@ -375,6 +368,11 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
375
368
|
if protocol.upper() == "HTTPS":
|
|
376
369
|
certificates = self._get_certificates()
|
|
377
370
|
|
|
371
|
+
if not certificates and protocol.upper() == "HTTPS":
|
|
372
|
+
message = "No certificates found for HTTPS listener. Please attach a certificate or create a certificate stack."
|
|
373
|
+
logger.warning(message)
|
|
374
|
+
raise ValueError(message)
|
|
375
|
+
|
|
378
376
|
listener = elbv2.ApplicationListener(
|
|
379
377
|
self,
|
|
380
378
|
listener_id,
|
|
@@ -427,8 +425,9 @@ class LoadBalancerStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
427
425
|
certificates = []
|
|
428
426
|
|
|
429
427
|
# Check SSM imported values first (takes priority)
|
|
430
|
-
|
|
431
|
-
|
|
428
|
+
ssm_imports = self.get_all_ssm_imports()
|
|
429
|
+
if "certificate_arns" in ssm_imports:
|
|
430
|
+
cert_arns = ssm_imports["certificate_arns"]
|
|
432
431
|
if not isinstance(cert_arns, list):
|
|
433
432
|
cert_arns = [cert_arns]
|
|
434
433
|
for cert_arn in cert_arns:
|
|
@@ -70,7 +70,7 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
70
70
|
db_name = deployment.build_resource_name(self.rds_config.name)
|
|
71
71
|
|
|
72
72
|
# Setup standardized SSM integration
|
|
73
|
-
self.
|
|
73
|
+
self.setup_ssm_integration(
|
|
74
74
|
scope=self,
|
|
75
75
|
config=self.rds_config,
|
|
76
76
|
resource_type="rds",
|
|
@@ -80,7 +80,7 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
80
80
|
)
|
|
81
81
|
|
|
82
82
|
# Process SSM imports
|
|
83
|
-
self.
|
|
83
|
+
self.process_ssm_imports()
|
|
84
84
|
|
|
85
85
|
# Get VPC and security groups
|
|
86
86
|
self.security_groups = self._get_security_groups()
|
|
@@ -72,7 +72,7 @@ class RumStack(IStack, StandardizedSsmMixin):
|
|
|
72
72
|
"cognito_identity_pool_id"
|
|
73
73
|
] = "/{{ORGANIZATION}}/{{ENVIRONMENT}}/cognito/user-pool/identity-pool-id"
|
|
74
74
|
|
|
75
|
-
self.
|
|
75
|
+
self.setup_ssm_integration(
|
|
76
76
|
scope=self,
|
|
77
77
|
config=rum_config,
|
|
78
78
|
resource_type="rum",
|
|
@@ -80,7 +80,7 @@ class RumStack(IStack, StandardizedSsmMixin):
|
|
|
80
80
|
)
|
|
81
81
|
|
|
82
82
|
# Process SSM imports using standardized method
|
|
83
|
-
self.
|
|
83
|
+
self.process_ssm_imports()
|
|
84
84
|
|
|
85
85
|
# Import or create Cognito resources
|
|
86
86
|
identity_pool_id, guest_role_arn = self._setup_cognito_integration()
|
|
@@ -341,7 +341,7 @@ class RumStack(IStack, StandardizedSsmMixin):
|
|
|
341
341
|
resource_values["user_pool_id"] = self.user_pool.user_pool_id
|
|
342
342
|
|
|
343
343
|
# Use enhanced SSM parameter export
|
|
344
|
-
exported_params = self.
|
|
344
|
+
exported_params = self.export_ssm_parameters(resource_values)
|
|
345
345
|
|
|
346
346
|
if exported_params:
|
|
347
347
|
logger.info(f"Exported {len(exported_params)} RUM parameters to SSM")
|