cdk-factory 0.13.2__py3-none-any.whl → 0.13.4__py3-none-any.whl

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.

@@ -118,11 +118,17 @@ class CloudFrontDistributionConstruct(Construct):
118
118
  origin_access_identity=self.oai,
119
119
  )
120
120
 
121
+ # Get comment from config, or use default
122
+ comment = "CloudFront Distribution generated via the CDK Factory"
123
+ if self.stack_config and isinstance(self.stack_config, StackConfig):
124
+ cloudfront_config = self.stack_config.dictionary.get("cloudfront", {})
125
+ comment = cloudfront_config.get("comment", comment)
126
+
121
127
  distribution = cloudfront.Distribution(
122
128
  self,
123
129
  "cloudfront-dist",
124
130
  domain_names=self.aliases,
125
- comment="CloudFront Distribution generated via the CDK Factory",
131
+ comment=comment,
126
132
  certificate=self.certificate,
127
133
  default_behavior=cloudfront.BehaviorOptions(
128
134
  origin=origin,
@@ -228,6 +234,15 @@ class CloudFrontDistributionConstruct(Construct):
228
234
  """
229
235
  Get the Lambda@Edge associations for the distribution from config.
230
236
 
237
+ Supports two configuration methods:
238
+ 1. Convenience flag: "enable_ip_gating": true
239
+ - Automatically adds Lambda@Edge IP gating function
240
+ - Uses auto-derived SSM parameter path: /{env}/{workload}/lambda-edge/version-arn
241
+
242
+ 2. Manual configuration: "lambda_edge_associations": [...]
243
+ - Full control over Lambda@Edge associations
244
+ - Can specify custom ARNs, event types, etc.
245
+
231
246
  Returns:
232
247
  List[cloudfront.EdgeLambda] or None: list of Lambda@Edge associations
233
248
  """
@@ -235,7 +250,33 @@ class CloudFrontDistributionConstruct(Construct):
235
250
 
236
251
  if self.stack_config and isinstance(self.stack_config, StackConfig):
237
252
  cloudfront_config = self.stack_config.dictionary.get("cloudfront", {})
238
- lambda_edge_associations = cloudfront_config.get("lambda_edge_associations", [])
253
+
254
+ # Check for convenience IP gating flag
255
+ enable_ip_gating = cloudfront_config.get("enable_ip_gating", False)
256
+ if enable_ip_gating:
257
+ logger.info("IP gating enabled via convenience flag - adding Lambda@Edge association")
258
+
259
+ # Extract environment and workload name from config
260
+ # These come from the workload/deployment configuration
261
+ workload_dict = self.stack_config.workload
262
+ environment = workload_dict.get("deployment", {}).get("environment", "dev")
263
+ workload_name = workload_dict.get("name", "workload")
264
+
265
+ # Auto-derive SSM parameter path or use override
266
+ default_ssm_path = f"/{environment}/{workload_name}/lambda-edge/version-arn"
267
+ ip_gate_ssm_path = cloudfront_config.get("ip_gate_function_ssm_path", default_ssm_path)
268
+
269
+ logger.info(f"Using IP gate Lambda ARN from SSM: {ip_gate_ssm_path}")
270
+
271
+ # Add the IP gating Lambda@Edge association
272
+ lambda_edge_associations = [{
273
+ "event_type": "origin-request",
274
+ "lambda_arn": f"{{{{ssm:{ip_gate_ssm_path}}}}}",
275
+ "include_body": False
276
+ }]
277
+ else:
278
+ # Use manual configuration
279
+ lambda_edge_associations = cloudfront_config.get("lambda_edge_associations", [])
239
280
 
240
281
  for association in lambda_edge_associations:
241
282
  event_type_str = association.get("event_type", "origin-request")
@@ -87,7 +87,10 @@ class LambdaEdgeStack(IStack, EnhancedSsmParameterMixin):
87
87
  deployment
88
88
  )
89
89
 
90
- function_name = deployment.build_resource_name(self.edge_config.name)
90
+ # Use the Lambda function name from config (supports template variables)
91
+ # e.g., "{{WORKLOAD_NAME}}-{{ENVIRONMENT}}-ip-gate" becomes "tech-talk-dev-ip-gate"
92
+ function_name = self.edge_config.name
93
+ logger.info(f"Lambda function name: '{function_name}'")
91
94
 
92
95
  # Create Lambda function
93
96
  self._create_lambda_function(function_name)
@@ -181,9 +184,10 @@ class LambdaEdgeStack(IStack, EnhancedSsmParameterMixin):
181
184
 
182
185
  # Create runtime configuration file for Lambda@Edge
183
186
  # Since Lambda@Edge doesn't support environment variables, we bundle a config file
187
+ # Use the full function_name (e.g., "tech-talk-dev-ip-gate") not just the base name
184
188
  runtime_config = {
185
189
  'environment': self.deployment.environment,
186
- 'function_name': self.edge_config.name,
190
+ 'function_name': function_name,
187
191
  'region': self.deployment.region
188
192
  }
189
193
 
cdk_factory/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.13.2"
1
+ __version__ = "0.13.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdk_factory
3
- Version: 0.13.2
3
+ Version: 0.13.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
@@ -2,7 +2,7 @@ cdk_factory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  cdk_factory/app.py,sha256=RnX0-pwdTAPAdKJK_j13Zl8anf9zYKBwboR0KA8K8xM,10346
3
3
  cdk_factory/cdk.json,sha256=SKZKhJ2PBpFH78j-F8S3VDYW-lf76--Q2I3ON-ZIQfw,3106
4
4
  cdk_factory/cli.py,sha256=FGbCTS5dYCNsfp-etshzvFlGDCjC28r6rtzYbe7KoHI,6407
5
- cdk_factory/version.py,sha256=blu6md2c3Nnj5gDBi8U36sYO3k8HcND8s7UoQBjfn3g,23
5
+ cdk_factory/version.py,sha256=6QrvAtwvKbCiayGvUAi82njNCcPWhkMC4sBk4mXPkIc,23
6
6
  cdk_factory/builds/README.md,sha256=9BBWd7bXpyKdMU_g2UljhQwrC9i5O_Tvkb6oPvndoZk,90
7
7
  cdk_factory/commands/command_loader.py,sha256=QbLquuP_AdxtlxlDy-2IWCQ6D-7qa58aphnDPtp_uTs,3744
8
8
  cdk_factory/configurations/base_config.py,sha256=JKjhNsy0RCUZy1s8n5D_aXXI-upR9izaLtCTfKYiV9k,9624
@@ -50,7 +50,7 @@ cdk_factory/configurations/resources/security_group.py,sha256=8kQtaaRVEn2aDm8XoC
50
50
  cdk_factory/configurations/resources/security_group_full_stack.py,sha256=x5MIMCa_olO7prFBKx9zVOfvsVdKo-2mWyhrCy27dFw,2031
51
51
  cdk_factory/configurations/resources/sqs.py,sha256=fAh2dqttJ6PX46enFRULuiLEu3TEj0Vb2xntAOgUpYE,4346
52
52
  cdk_factory/configurations/resources/vpc.py,sha256=sNn6w76bHFwmt6N76gZZhqpsuNB9860C1SZu6tebaXY,3835
53
- cdk_factory/constructs/cloudfront/cloudfront_distribution_construct.py,sha256=ZTlRUFhfrkIv95buChJiNh-nd_hmGjUxT5LaPScStgY,17902
53
+ cdk_factory/constructs/cloudfront/cloudfront_distribution_construct.py,sha256=MS3xrjm1I4gnUZorh2Orc6oi_fZE_ZPU29czDDhiD_A,20072
54
54
  cdk_factory/constructs/ecr/ecr_construct.py,sha256=JLz3gWrsjlM0XghvbgxuoGlF-VIo_7IYxtgX7mTkidE,10660
55
55
  cdk_factory/constructs/lambdas/lambda_function_construct.py,sha256=SQ5SEXn4kezVAzXuv_A_JB3o_svyBXOMi-htvfB9HQs,4516
56
56
  cdk_factory/constructs/lambdas/lambda_function_docker_construct.py,sha256=aSyn3eh1YnuIahZ7CbZ5WswwPL8u70ZibMoS24QQifc,9907
@@ -95,7 +95,7 @@ cdk_factory/stack_library/ecr/ecr_stack.py,sha256=1xA68sxFVyqreYjXrP_7U9I8RF9RtF
95
95
  cdk_factory/stack_library/ecs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
96
  cdk_factory/stack_library/ecs/ecs_service_stack.py,sha256=zuGdZEP5KmeVDTJb-H47LYhvs-85-Fi4Xb78nsA-lF4,24685
97
97
  cdk_factory/stack_library/lambda_edge/__init__.py,sha256=ByBJ_CWdc4UtTmFBZH-6pzBMNkjkdtE65AmnB0Fs6lM,156
98
- cdk_factory/stack_library/lambda_edge/lambda_edge_stack.py,sha256=fCnS_WFUwe9gyvsqrevevrDcUqZpZgnwM8v9tQVxFzk,15491
98
+ cdk_factory/stack_library/lambda_edge/lambda_edge_stack.py,sha256=kTPjvS-IqBbYyqLG-YUtfiVrkX4HFUTzXamzdflDtCE,15780
99
99
  cdk_factory/stack_library/load_balancer/__init__.py,sha256=wZpKw2OecLJGdF5mPayCYAEhu2H3c2gJFFIxwXftGDU,52
100
100
  cdk_factory/stack_library/load_balancer/load_balancer_stack.py,sha256=t5JUe5lMUbQCRFZR08k8nO-g-53yWY8gKB9v8ZnedBs,24391
101
101
  cdk_factory/stack_library/monitoring/__init__.py,sha256=k1G_KDx47Aw0UugaL99PN_TKlyLK4nkJVApCaAK7GJg,153
@@ -129,8 +129,8 @@ cdk_factory/utilities/lambda_function_utilities.py,sha256=S1GvBsY_q2cyUiaud3HORJ
129
129
  cdk_factory/utilities/os_execute.py,sha256=5Op0LY_8Y-pUm04y1k8MTpNrmQvcLmQHPQITEP7EuSU,1019
130
130
  cdk_factory/utils/api_gateway_utilities.py,sha256=If7Xu5s_UxmuV-kL3JkXxPLBdSVUKoLtohm0IUFoiV8,4378
131
131
  cdk_factory/workload/workload_factory.py,sha256=mM8GU_5mKq_0OyK060T3JrUSUiGAcKf0eqNlT9mfaws,6028
132
- cdk_factory-0.13.2.dist-info/METADATA,sha256=LyiWwDWEaFep_Koxoo46zUxv3Lza_88v4T45EK7zNeg,2451
133
- cdk_factory-0.13.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
- cdk_factory-0.13.2.dist-info/entry_points.txt,sha256=S1DPe0ORcdiwEALMN_WIo3UQrW_g4YdQCLEsc_b0Swg,53
135
- cdk_factory-0.13.2.dist-info/licenses/LICENSE,sha256=NOtdOeLwg2il_XBJdXUPFPX8JlV4dqTdDGAd2-khxT8,1066
136
- cdk_factory-0.13.2.dist-info/RECORD,,
132
+ cdk_factory-0.13.4.dist-info/METADATA,sha256=sGZgb7401ZPUYcigvG6cwLfwArL98CJnL4U5O3mgeL8,2451
133
+ cdk_factory-0.13.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
+ cdk_factory-0.13.4.dist-info/entry_points.txt,sha256=S1DPe0ORcdiwEALMN_WIo3UQrW_g4YdQCLEsc_b0Swg,53
135
+ cdk_factory-0.13.4.dist-info/licenses/LICENSE,sha256=NOtdOeLwg2il_XBJdXUPFPX8JlV4dqTdDGAd2-khxT8,1066
136
+ cdk_factory-0.13.4.dist-info/RECORD,,