From 006eccf8ecf1e2e5a227da9abbc187168299e458 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Wed, 10 Sep 2025 13:42:43 +0000 Subject: [PATCH] check if lambda is set up correctly --- .github/workflows/lambda_main.yml | 25 ++++++++++++++++++- .../lambda/walthamforest_etl/docker/app.py | 2 ++ .../lambda/walthamforest_etl/docker/ecr.tf | 2 +- .../walthamforest_etl_lambda.tf | 4 +-- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lambda_main.yml b/.github/workflows/lambda_main.yml index 6330833..c83d0f0 100644 --- a/.github/workflows/lambda_main.yml +++ b/.github/workflows/lambda_main.yml @@ -2,7 +2,7 @@ name: Lambda Main Workflow on: push: - branches: [main, feautre/additional_features_in_condition_report_extraction] + branches: [main, feautre/walthamforest_etl] env: AWS_REGION: eu-west-2 @@ -67,3 +67,26 @@ jobs: git-sha: ${{ github.sha }} git-ref: ${{ github.ref_name }} + + walthamforest-etl: + runs-on: ubuntu-latest + needs: shared-lambda-terraform + permissions: + id-token: write + contents: read + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Build and deploy WalthamForest ETL + uses: ./.github/workflows/actions/lambda-deploy + with: + lambda_name: walthamforest_etl + dockerfile_path: ./deployment/lambda/walthamforest_etl/docker/Dockerfile + ecr_tf_dir: ./deployment/lambda/walthamforest_etl/docker/ + lambda_tf_dir: ./deployment/lambda/walthamforest_etl/ + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + git-sha: ${{ github.sha }} + git-ref: ${{ github.ref_name }} \ No newline at end of file diff --git a/deployment/lambda/walthamforest_etl/docker/app.py b/deployment/lambda/walthamforest_etl/docker/app.py index 2f82c66..1cb261f 100644 --- a/deployment/lambda/walthamforest_etl/docker/app.py +++ b/deployment/lambda/walthamforest_etl/docker/app.py @@ -4,6 +4,8 @@ from pprint import pprint def handler(event, context): # read data for houses only + print("waltham forest set up correctly") + return None df = pd.read_excel("../../home/Downloads/data.xlsx", sheet_name="Houses Asset Data") element_cols = [ diff --git a/deployment/lambda/walthamforest_etl/docker/ecr.tf b/deployment/lambda/walthamforest_etl/docker/ecr.tf index 36bec88..5fceebc 100644 --- a/deployment/lambda/walthamforest_etl/docker/ecr.tf +++ b/deployment/lambda/walthamforest_etl/docker/ecr.tf @@ -1,6 +1,6 @@ # ECR repo resource "aws_ecr_repository" "walthamforest_etl" { - name = "walthamforest_etl" + name = "walthamforest_etl_ecr" } # ECR policy to allow Lambda access diff --git a/deployment/lambda/walthamforest_etl/walthamforest_etl_lambda.tf b/deployment/lambda/walthamforest_etl/walthamforest_etl_lambda.tf index 2780add..c8b776e 100644 --- a/deployment/lambda/walthamforest_etl/walthamforest_etl_lambda.tf +++ b/deployment/lambda/walthamforest_etl/walthamforest_etl_lambda.tf @@ -8,7 +8,7 @@ data "aws_ecr_repository" "walthamforest_etl_ecr" { name = "walthamforest_etl_ecr" } -# SQS queue for extractor_and_loader +# SQS queue resource "aws_sqs_queue" "walthamforest_etl_queue" { name = "walthamforest_etl-queue" } @@ -54,7 +54,7 @@ resource "aws_iam_role_policy_attachment" "walthamforest_etl_policy_attach" { } # Lambda function -resource "aws_lambda_function" "waltham_forest_etl" { +resource "aws_lambda_function" "walthamforest_etl" { function_name = "walthamforest_etl" role = data.aws_iam_role.lambda_exec_role.arn package_type = "Image"