Skip to content

Commit

Permalink
UML-3727: rename and Lambda RIE (#2994)
Browse files Browse the repository at this point in the history
* UML-3727: event receiver lambda

* update name to event-receiver

* remove old files

* rename resources

* fix typo

* fix typo

* use svc prefix and suffix

* add if statement back

* fix missed -
  • Loading branch information
jay-whitwell authored Dec 10, 2024
1 parent f3bdb7c commit aab3c5e
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 23 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/_build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ jobs:
run_unit_tests: 'true'
run_integration_tests: 'false'
artifact_to_dl: ''
- svc_prefix: 'ingestion'
svc_suffix: 'lambda'
- svc_prefix: 'event'
svc_suffix: 'receiver'
build_development_docker: 'false'
run_unit_tests: 'false'
run_integration_tests: 'false'
Expand Down Expand Up @@ -264,9 +264,10 @@ jobs:
elif [[ "${SVC_PREFIX}" = "stats_upload" ]]; then
docker build --no-cache --file lambda-functions/upload-statistics/Dockerfile --tag stats_upload_lambda:latest lambda-functions/upload-statistics
elif [[ "${SVC_PREFIX}" = "ingestion" ]]; then
docker build --file lambda-functions/ingestion-lambda/Dockerfile --tag ingestion_lambda:latest lambda-functions/ingestion-lambda
elif [[ "${SVC_PREFIX}" = "event" ]]; then
if [[ "${SVC_SUFFIX}" = "receiver" ]]; then
docker build --file lambda-functions/${SVC_PREFIX}-${SVC_SUFFIX}/Dockerfile --tag ${SVC_PREFIX}_${SVC_SUFFIX}:latest lambda-functions/${SVC_PREFIX}-${SVC_SUFFIX}
fi
fi
if: (inputs.specific_path == 'all' || inputs.specific_path == matrix.svc_prefix)

Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,26 @@ services:
ports:
- 9007:8080


# ---------------------------
# Lambda for ingestion from MLPA

event-reciever-lambda:
container_name: event-reciever
build:
context: ./lambda-functions/event-reciever
dockerfile: Dockerfile
environment:
ENVIRONMENT: local
REGION: eu-west-1
AWS_ACCESS_KEY_ID: 'devkey'
AWS_SECRET_ACCESS_KEY: 'secretdevkey'
volumes:
- ./lambda-functions/event-reciever/app:/function/app
- ./lambda-functions/.aws-lambda-rie:/aws-lambda
ports:
- 9008:8080

proxy:
container_name: proxy
image: traefik:3.0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions terraform/account/region.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module "eu_west_1" {
environment_name = local.environment
lambda_container_version = var.lambda_container_version
vpc_flow_logs_iam_role = aws_iam_role.vpc_flow_logs
ingestion_lambda_enabled = true
event_receiver_enabled = true

depends_on = [
module.cloudwatch_mrk,
Expand Down Expand Up @@ -36,7 +36,7 @@ module "eu_west_2" {
environment_name = local.environment
lambda_container_version = var.lambda_container_version
vpc_flow_logs_iam_role = aws_iam_role.vpc_flow_logs
ingestion_lambda_enabled = false
event_receiver_enabled = false

depends_on = [
module.cloudwatch_mrk,
Expand Down
14 changes: 7 additions & 7 deletions terraform/account/region/lambda_functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ data "aws_ecr_repository" "ship_to_opg_metrics" {
provider = aws.management
}

data "aws_ecr_repository" "ingestion_repo" {
name = "use_an_lpa/ingestion_lambda"
data "aws_ecr_repository" "event_receiver_repo" {
name = "use_an_lpa/event_receiver"
provider = aws.management
}

module "ingestion_lambda" {
count = var.ingestion_lambda_enabled ? 1 : 0
module "event_receiver" {
count = var.event_receiver_enabled ? 1 : 0
source = "./modules/lambda_function"
lambda_name = "ingestion-lambda-${var.account_name}"
lambda_name = "event-receiver-${var.account_name}"
working_directory = "/"
image_uri = "${data.aws_ecr_repository.ingestion_repo.repository_url}:${var.lambda_container_version}"
ecr_arn = data.aws_ecr_repository.ingestion_repo.arn
image_uri = "${data.aws_ecr_repository.event_receiver_repo.repository_url}:${var.lambda_container_version}"
ecr_arn = data.aws_ecr_repository.event_receiver_repo.arn
aws_cloudwatch_log_group_kms_key_id = data.aws_kms_alias.cloudwatch_mrk.arn

providers = {
Expand Down
4 changes: 2 additions & 2 deletions terraform/account/region/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ variable "environment_name" {
type = string
}

variable "ingestion_lambda_enabled" {
description = "Enable the ingestion lambda"
variable "event_receiver_enabled" {
description = "Enable the event receiver Lambda"
type = bool
}
variable "lambda_container_version" {
Expand Down
18 changes: 12 additions & 6 deletions terraform/account/terraform.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"development": {
"account_id": "367815980639",
"cloudwatch_application_insights_enabled": true,
"ingestion_lambda_enabled": true,
"event_receiver_enabled": true,
"shared_account_id": "679638075911",
"is_production": false,
"retention_in_days": 7,
Expand All @@ -27,7 +27,9 @@
"int.lpa-codes.api.opg.service.justice.gov.uk.",
"dev.lpa.api.opg.service.justice.gov.uk."
],
"domains_blocked": ["*."]
"domains_blocked": [
"*."
]
},
"dynamodb_cloudtrail": {
"enabled": false,
Expand All @@ -47,7 +49,7 @@
"preproduction": {
"account_id": "888228022356",
"cloudwatch_application_insights_enabled": false,
"ingestion_lambda_enabled": false,
"event_receiver_enabled": false,
"shared_account_id": "679638075911",
"is_production": false,
"retention_in_days": 7,
Expand All @@ -66,7 +68,9 @@
"int.lpa-codes.api.opg.service.justice.gov.uk.",
"dev.lpa.api.opg.service.justice.gov.uk."
],
"domains_blocked": ["*."]
"domains_blocked": [
"*."
]
},
"dynamodb_cloudtrail": {
"enabled": false,
Expand All @@ -86,7 +90,7 @@
"production": {
"account_id": "690083044361",
"cloudwatch_application_insights_enabled": true,
"ingestion_lambda_enabled": false,
"event_receiver_enabled": false,
"shared_account_id": "679638075911",
"is_production": true,
"retention_in_days": 400,
Expand All @@ -105,7 +109,9 @@
"lpa-codes.api.opg.service.justice.gov.uk.",
"lpa.api.opg.service.justice.gov.uk."
],
"domains_blocked": ["*."]
"domains_blocked": [
"*."
]
},
"dynamodb_cloudtrail": {
"enabled": true,
Expand Down
2 changes: 1 addition & 1 deletion terraform/account/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "accounts" {
account_id = string
cloudwatch_application_insights_enabled = bool
shared_account_id = number
ingestion_lambda_enabled = bool
event_receiver_enabled = bool
is_production = bool
retention_in_days = number
pagerduty_service_name = string
Expand Down

0 comments on commit aab3c5e

Please sign in to comment.