Merge pull request #711 from Hestia-Homes/deploy-categorisation

New ECR repository for Categorisation
This commit is contained in:
Daniel Roth 2026-02-16 17:16:26 +00:00 committed by GitHub
commit abf0a036d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 88 additions and 3 deletions

View file

@ -52,6 +52,7 @@ jobs:
runs-on: ubuntu-latest
env:
STAGE: ${{ needs.determine_stage.outputs.stage }}
TERRAFORM_APPLY: ${{ needs.determine_stage.outputs.terraform_apply }}
steps:
- uses: actions/checkout@v4

View file

@ -3,7 +3,7 @@
### 1. Create the Lambda scaffold
- Copy the template:
cp -r lambda/_template lambda/<lambda_name>
`cp -r lambda/_template lambda/<lambda_name>`
---
@ -12,8 +12,7 @@
infrastructure/terraform/shared/main.tf
- Apply the shared stack
- This requires commenting 'if env.stage == "prod"' in .github/workflows/deploy_terraform.yml
- Create a PR to deploy this to main then dev in order to deploy the shared stack
- Verify the ECR repository exists in AWS

View file

@ -0,0 +1,27 @@
data "terraform_remote_state" "shared" {
backend = "s3"
config = {
bucket = "assessment-model-terraform-state"
key = "env:/${var.stage}/terraform.tfstate"
region = "eu-west-2"
}
}
module "lambda" {
source = "../modules/lambda_with_sqs"
name = "categorisation"
stage = var.stage
image_uri = local.image_uri
environment = merge(
{
STAGE = var.stage
LOG_LEVEL = "info"
DB_USERNAME = local.db_credentials.db_assessment_model_username
DB_PASSWORD = local.db_credentials.db_assessment_model_password
}
)
}

View file

@ -0,0 +1,16 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.16"
}
}
backend "s3" {
bucket = "categorisation"
key = "terraform.tfstate"
region = "eu-west-2"
}
required_version = ">= 1.2.0"
}

View file

@ -0,0 +1,27 @@
variable "lambda_name" {
type = string
description = "Logical name of the lambda (e.g. address2uprn)"
}
variable "stage" {
description = "Deployment stage (e.g. dev, prod)"
type = string
}
variable "ecr_repo_url" {
type = string
description = "ECR repository URL (no tag, no digest)"
}
variable "image_digest" {
type = string
description = "Image digest (sha256:...)"
}
locals {
image_uri = "${var.ecr_repo_url}@${var.image_digest}"
}
output "resolved_image_uri" {
value = local.image_uri
}

View file

@ -392,4 +392,19 @@ module "postcode_splitter_s3_read" {
output "postcode_splitter_s3_read_arn" {
value = module.postcode_splitter_s3_read.policy_arn
}
################################################
# Categorisation Lambda ECR
################################################
module "categorisation_state_bucket" {
source = "../modules/tf_state_bucket"
bucket_name = "categorisation-terraform-state"
}
module "categorisation_registry" {
source = "../modules/container_registry"
name = "categorisation"
stage = var.stage
}