Skip to content

Commit

Permalink
feat: [sc-26013] Fix Deployment Error for NameGuard Lambda (#508)
Browse files Browse the repository at this point in the history
* Added fixes for lambda

* Added directory walk for lambda deployment for docker build

* Fixed directory walk

* Fixed docker file path

* Another fix

* Another path fix

* Fixed path issues

* Fixed role name

* Fixed policy name for logging
  • Loading branch information
BanaSeba authored Dec 27, 2024
1 parent 90af85c commit 3c69812
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 185 deletions.
181 changes: 0 additions & 181 deletions apps/api.nameguard.io/serverless.yml

This file was deleted.

5 changes: 4 additions & 1 deletion apps/api.nameguard.io/terraform/deploy_lambda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,13 @@ if [ ! -f "../Dockerfile" ]; then
fi

echo "Building Docker image..."
if ! docker build ../ -t nameguard; then
cd ../../../packages/nameguard-python
cp ../../apps/api.nameguard.io/Dockerfile ./Dockerfile
if ! docker build . -t nameguard; then
echo "Error: Docker build failed"
exit 1
fi
cd ../../apps/api.nameguard.io/terraform

echo "Tagging Docker image..."
if ! docker tag nameguard:latest ${ECR_URL}:latest; then
Expand Down
6 changes: 4 additions & 2 deletions apps/api.nameguard.io/terraform/modules/lambda_api/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ locals {
}

resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda-${var.env}"
name = "nameguard-lambda-role-${var.env}"
assume_role_policy = data.aws_iam_policy_document.assume_role.json
tags = local.common_tags
}
Expand All @@ -40,7 +40,7 @@ data "aws_iam_policy_document" "lambda_logging" {
}

resource "aws_iam_policy" "lambda_logging" {
name = "lambda_logging-${var.env}"
name = "nameguard_lambda_logging-${var.env}"
path = "/"
description = "IAM policy for logging from a lambda"
policy = data.aws_iam_policy_document.lambda_logging.json
Expand Down Expand Up @@ -106,6 +106,8 @@ resource "aws_cloudfront_distribution" "api_distribution" {
https_port = 443
origin_protocol_policy = "https-only"
origin_ssl_protocols = ["TLSv1.2"]
origin_read_timeout = 60
origin_keepalive_timeout = 60
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/api.nameguard.io/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ variable "image_uri" {
}

variable "domain_name" {
description = "Custom domain name for API Gateway"
description = "Custom domain name for API"
type = string
}

Expand Down

0 comments on commit 3c69812

Please sign in to comment.