Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion infrastructure/terraform/components/dl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ No requirements.
| <a name="module_lambda_lambda_apim_refresh_token"></a> [lambda\_lambda\_apim\_refresh\_token](#module\_lambda\_lambda\_apim\_refresh\_token) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
| <a name="module_mesh_acknowledge"></a> [mesh\_acknowledge](#module\_mesh\_acknowledge) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
| <a name="module_mesh_download"></a> [mesh\_download](#module\_mesh\_download) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
| <a name="module_mesh_poll"></a> [mesh\_poll](#module\_mesh\_poll) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
| <a name="module_mesh_poll"></a> [mesh\_poll](#module\_mesh\_poll) | ../../modules/wrappers/lambda | n/a |
| <a name="module_move_scanned_files"></a> [move\_scanned\_files](#module\_move\_scanned\_files) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
| <a name="module_pdm_mock"></a> [pdm\_mock](#module\_pdm\_mock) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
| <a name="module_pdm_poll"></a> [pdm\_poll](#module\_pdm\_poll) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "mesh_poll" {
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip"
source = "../../modules/wrappers/lambda"

function_name = "mesh-poll"
description = "A lambda function for polling MESH inbox for new messages"
Expand Down
19 changes: 19 additions & 0 deletions infrastructure/terraform/modules/wrappers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- BEGIN_TF_DOCS -->
<!-- markdownlint-disable -->
<!-- vale off -->

## Requirements

No requirements.
## Inputs

No inputs.
## Modules

No modules.
## Outputs

No outputs.
<!-- vale on -->
<!-- markdownlint-enable -->
<!-- END_TF_DOCS -->
33 changes: 33 additions & 0 deletions infrastructure/terraform/modules/wrappers/lambda/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Wrapper module for lambda - centralizes the source version
# To update the module version, change the source URL below
module "lambda" {
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.30/terraform-lambda.zip"

function_name = var.function_name
description = var.description
aws_account_id = var.aws_account_id
component = var.component
environment = var.environment
project = var.project
region = var.region
group = var.group
log_retention_in_days = var.log_retention_in_days
kms_key_arn = var.kms_key_arn
iam_policy_document = var.iam_policy_document
function_s3_bucket = var.function_s3_bucket
function_code_base_path = var.function_code_base_path
function_code_dir = var.function_code_dir
function_include_common = var.function_include_common
function_module_name = var.function_module_name
handler_function_name = var.handler_function_name
runtime = var.runtime
memory = var.memory
timeout = var.timeout
log_level = var.log_level
schedule = try(var.schedule, null)
force_lambda_code_deploy = var.force_lambda_code_deploy
enable_lambda_insights = var.enable_lambda_insights
log_destination_arn = var.log_destination_arn
log_subscription_role_arn = var.log_subscription_role_arn
lambda_env_vars = try(var.lambda_env_vars, {})
}
12 changes: 12 additions & 0 deletions infrastructure/terraform/modules/wrappers/lambda/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Outputs from lambda wrapper module
# These expose the outputs from the upstream nhs-notify-shared-modules lambda module

output "function_arn" {
description = "ARN of the Lambda function"
value = module.lambda.function_arn
}

output "function_name" {
description = "Name of the Lambda function"
value = module.lambda.function_name
}
139 changes: 139 additions & 0 deletions infrastructure/terraform/modules/wrappers/lambda/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Variables for lambda wrapper module
# These mirror the variables from the upstream nhs-notify-shared-modules lambda module

variable "function_name" {
type = string
description = "The name of the Lambda function"
}

variable "description" {
type = string
description = "Description of the Lambda function"
}

variable "aws_account_id" {
type = string
description = "AWS Account ID"
}

variable "component" {
type = string
description = "Component name"
}

variable "environment" {
type = string
description = "Environment name"
}

variable "project" {
type = string
description = "Project name"
}

variable "region" {
type = string
description = "AWS Region"
}

variable "group" {
type = string
description = "Group name"
}

variable "log_retention_in_days" {
type = number
description = "CloudWatch log retention in days"
}

variable "kms_key_arn" {
type = string
description = "KMS key ARN for encryption"
}

variable "iam_policy_document" {
type = any
description = "IAM policy document for the Lambda execution role"
}

variable "function_s3_bucket" {
type = string
description = "S3 bucket containing the Lambda function code"
}

variable "function_code_base_path" {
type = string
description = "Base path for Lambda function code"
}

variable "function_code_dir" {
type = string
description = "Directory containing the Lambda function code"
}

variable "function_include_common" {
type = bool
description = "Whether to include common code"
}

variable "function_module_name" {
type = string
description = "Module name for the function"
}

variable "handler_function_name" {
type = string
description = "Handler function name"
}

variable "runtime" {
type = string
description = "Lambda runtime (e.g., nodejs22.x, python3.12)"
}

variable "memory" {
type = number
description = "Memory allocation for the Lambda function in MB"
}

variable "timeout" {
type = number
description = "Timeout for the Lambda function in seconds"
}

variable "log_level" {
type = string
description = "Log level for the Lambda function"
}

variable "schedule" {
type = string
description = "CloudWatch Events schedule expression (optional)"
default = null
}

variable "force_lambda_code_deploy" {
type = bool
description = "Force deployment of Lambda code"
}

variable "enable_lambda_insights" {
type = bool
description = "Enable Lambda Insights"
}

variable "log_destination_arn" {
type = string
description = "ARN of the log destination"
}

variable "log_subscription_role_arn" {
type = string
description = "ARN of the role for log subscription"
}

variable "lambda_env_vars" {
type = map(string)
description = "Environment variables for the Lambda function"
default = {}
}