diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b099941..f17efe7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,8 @@ name: Deploy Lambdas & Terraform Plan on PR +env: + RICH_PDF_INGESTION: rich_pdf_ingestion + on: push: branches: @@ -33,6 +36,7 @@ jobs: aws ecr describe-repositories --repository-names ${{ vars.RESUME_REQUEST_PROCESSOR_ECR_NAME }} || aws ecr create-repository --repository-name ${{ vars.RESUME_REQUEST_PROCESSOR_ECR_NAME }} aws ecr describe-repositories --repository-names ${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }} || aws ecr create-repository --repository-name ${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }} aws ecr describe-repositories --repository-names ${{ vars.RESUME_ECR_NAME }} || aws ecr create-repository --repository-name ${{ vars.RESUME_ECR_NAME }} + aws ecr describe-repositories --repository-names $RICH_PDF_INGESTION || aws ecr create-repository --repository-name $RICH_PDF_INGESTION - name: Generate timestamp id: timestamp @@ -60,6 +64,8 @@ jobs: docker push $ECR_REGISTRY/${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }}:$IMAGE_TAG docker build -t $ECR_REGISTRY/${{ vars.RESUME_ECR_NAME }}:$IMAGE_TAG ./lambdas/ResumeProcessor/ResumeFunction docker push $ECR_REGISTRY/${{ vars.RESUME_ECR_NAME }}:$IMAGE_TAG + docker build -t $ECR_REGISTRY/$RICH_PDF_INGESTION:$IMAGE_TAG ./lambdas/$RICH_PDF_INGESTION/src + docker push $ECR_REGISTRY/$RICH_PDF_INGESTION:$IMAGE_TAG deploy-infra: if: github.event_name == 'push' && github.ref == 'refs/heads/main' @@ -120,4 +126,6 @@ jobs: -var="resume_request_processor_lambda_repository_name=${{ vars.RESUME_REQUEST_PROCESSOR_ECR_NAME }}" \ -var="resume_request_preprocessor_lambda_repository_name=${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }}" \ -var="resume_lambda_repository_name=${{ vars.RESUME_ECR_NAME }}" \ + -var="resume_lambda_repository_name=$RICH_PDF_INGESTION \ + -auto-approve -no-color -input=false \ No newline at end of file diff --git a/lambdas/rich_pdf_ingestion/lambda.tf b/lambdas/rich_pdf_ingestion/lambda.tf index 4139672..8262356 100644 --- a/lambdas/rich_pdf_ingestion/lambda.tf +++ b/lambdas/rich_pdf_ingestion/lambda.tf @@ -2,7 +2,6 @@ locals { lambda_function_name = "rich_pdf_ingestion" ses_arn = "arn:aws:ses:${var.aws_region}:${data.aws_caller_identity.current.account_id}" timeout = 30 - runtime = "python3.11" powertools_layer_arn = "arn:aws:lambda:${var.aws_region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:67" } @@ -12,17 +11,18 @@ data "aws_caller_identity" "current" {} module "lambda_function_container_image" { source = "terraform-aws-modules/lambda/aws" function_name = local.lambda_function_name - handler = "index.lambda_handler" publish = true - runtime = local.runtime timeout = local.timeout layers = [local.powertools_layer_arn] source_path = "${path.module}/src" - s3_bucket = var.lambda_storage_bucket memory_size = 256 role_name = "${local.lambda_function_name}-role" attach_policy_statements = true + create_package = false + image_uri = data.aws_ecr_image.lambda_image.image_uri + package_type = "Image" + policy_statements = { log_group = { effect = "Allow"