Skip to content

Commit

Permalink
Update naming convention for CDK to avoid duplicates in IaC
Browse files Browse the repository at this point in the history
  • Loading branch information
san99tiago committed Feb 29, 2024
1 parent 0bd4195 commit c53f3ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cdk.context.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main_resources_name": "fastapi-lambda",
"main_resources_name": "fastapi-lambda-cdk",
"tags": {
"Owner": "Santiago Garcia Arango",
"Source": "https://github.com/san99tiago/aws-fastapi-lambda",
Expand Down
6 changes: 4 additions & 2 deletions cdk/stacks/cdk_lambda_fastapi_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def create_lambda_layers(self):
# Layer for "FastAPI" and "Mangum" Adapter libraries
self.lambda_layer_fastapi = aws_lambda.LayerVersion(
self,
id="LambdaLayer-FastAPI",
"LambdaLayer-FastAPI",
layer_version_name=f"{self.main_resources_name}-layer-{self.deployment_environment}",
code=aws_lambda.Code.from_asset("lambda-layers/fastapi/modules"),
compatible_runtimes=[
aws_lambda.Runtime.PYTHON_3_11,
Expand All @@ -74,7 +75,8 @@ def create_lambda_functions(self):
)
self.lambda_fastapi: aws_lambda.Function = aws_lambda.Function(
self,
id="Lambda-FastAPI",
"Lambda-FastAPI",
function_name=f"{self.main_resources_name}-lambda-{self.deployment_environment}",
runtime=aws_lambda.Runtime.PYTHON_3_12,
handler="api/main.handler",
code=aws_lambda.Code.from_asset(PATH_TO_LAMBDA_FUNCTION_FOLDER),
Expand Down

0 comments on commit c53f3ed

Please sign in to comment.