From 9401d38548a41112f552f7129906344b06a4816a Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Thu, 5 Feb 2026 09:11:05 +0000 Subject: [PATCH] start defining terraform --- .../terraform/lambda/condition_etl/main.tf | 14 ++++++++++ .../lambda/condition_etl/provider.tf | 16 +++++++++++ .../lambda/condition_etl/variables.tf | 27 +++++++++++++++++++ infrastructure/terraform/shared/main.tf | 20 +++++++++----- 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 infrastructure/terraform/lambda/condition_etl/main.tf create mode 100644 infrastructure/terraform/lambda/condition_etl/provider.tf create mode 100644 infrastructure/terraform/lambda/condition_etl/variables.tf diff --git a/infrastructure/terraform/lambda/condition_etl/main.tf b/infrastructure/terraform/lambda/condition_etl/main.tf new file mode 100644 index 00000000..3010aa8a --- /dev/null +++ b/infrastructure/terraform/lambda/condition_etl/main.tf @@ -0,0 +1,14 @@ +module "lambda" { + source = "../modules/lambda_with_sqs" + + name = REPLACE ME #"address2uprn" for example + stage = var.stage + + image_uri = local.image_uri + + + environment = { + STAGE = var.stage + LOG_LEVEL = "info" + } +} diff --git a/infrastructure/terraform/lambda/condition_etl/provider.tf b/infrastructure/terraform/lambda/condition_etl/provider.tf new file mode 100644 index 00000000..37c412ce --- /dev/null +++ b/infrastructure/terraform/lambda/condition_etl/provider.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.16" + } + } + + backend "s3" { + bucket = REPLACE_ME + key = "terraform.tfstate" + region = "eu-west-2" + } + + required_version = ">= 1.2.0" +} \ No newline at end of file diff --git a/infrastructure/terraform/lambda/condition_etl/variables.tf b/infrastructure/terraform/lambda/condition_etl/variables.tf new file mode 100644 index 00000000..e4bab243 --- /dev/null +++ b/infrastructure/terraform/lambda/condition_etl/variables.tf @@ -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 +} diff --git a/infrastructure/terraform/shared/main.tf b/infrastructure/terraform/shared/main.tf index 3ba78ef3..02962a29 100644 --- a/infrastructure/terraform/shared/main.tf +++ b/infrastructure/terraform/shared/main.tf @@ -298,10 +298,6 @@ module "address2uprn_state_bucket" { } -output "address2uprn_state_bucket_name" { - value = module.address2uprn_state_bucket.bucket_name -} - module "address2uprn_registry" { source = "../modules/container_registry" name = "address2uprn" @@ -309,6 +305,18 @@ module "address2uprn_registry" { } -output "address2uprn_repository_url" { - value = module.address2uprn_registry.repository_url +################################################ +# Condition ETL – Lambda ECR +################################################ +module "condition_etl_state_bucket" { + source = "../modules/tf_state_bucket" + bucket_name = "condition-etl-terraform-state" + +} + +module "condition_etl_registry" { + source = "../modules/container_registry" + name = "condition-etl" + stage = var.stage + } \ No newline at end of file