generated from NHSDigital/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 2
ELI-205 : Configure provision lambda #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Karthikeyannhs
merged 36 commits into
main
from
feature/ash-kt-eli-205-configure-provision-lambda
May 13, 2025
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
87191f0
lambda with dynamodb read-access
Karthikeyannhs cb09443
fixed handler name
Karthikeyannhs 80abf68
kms for lambda & added tags for kms in dynamodb and lambda modules
Karthikeyannhs ac9a9bd
lint fixed for temporary app
Karthikeyannhs e8a0a6c
lambda logs integration, terraform format
Karthikeyannhs 0909523
lambda runtime, timeout, memory_size & formatting
Karthikeyannhs 89edf15
clean up
Karthikeyannhs 8a434f9
lambda s3 policies
Karthikeyannhs 32d31cd
lambda vpc integration
Karthikeyannhs 418e10b
fix for state issue
Karthikeyannhs 8173a28
fix for state issue in api-layer
Karthikeyannhs ef61e96
tf code cleanup
Karthikeyannhs f382f49
lambda zip output path changed
Karthikeyannhs 4ba1c69
created variables for the lambda resource params
Karthikeyannhs 090b65a
Replace dummy Lambda with real function; increase timeout to 30s for …
Karthikeyannhs 784af81
give lambda role to decrypt kms key
Karthikeyannhs 9922fa3
NACL restrictions relaxed: allow all outbound traffic from private su…
Karthikeyannhs 68674bd
decoupled api layer from networking, passed req env var to lambda
Karthikeyannhs 885db77
updated config to pick cred&URL by env
Karthikeyannhs 028ce37
Merge branch 'main' into feature/ash-kt-eli-205-configure-provision-l…
Karthikeyannhs b306288
decoupled api-layer from iam-developer-roles
Karthikeyannhs c4c7e73
cleaned iam-developer roles - after api-layer decoupling
Karthikeyannhs ca192bb
Update src/eligibility_signposting_api/config.py
Karthikeyannhs e6b10d3
Update tests/unit/repos/test_factory.py
Karthikeyannhs 8f0935a
Update tests/unit/repos/test_factory.py
Karthikeyannhs ccfb489
Update tests/unit/repos/test_factory.py
Karthikeyannhs d780ffa
Update tests/unit/repos/test_factory.py
Karthikeyannhs 4479101
tf code cleanup - clearing out the TODOs
Karthikeyannhs 4adc53b
config, factory test fixed
Karthikeyannhs 23efa11
explained config and envs in README.md
Karthikeyannhs 0a3b8fa
code cleanup
Karthikeyannhs 595b234
added dynamodb:BatchWriteItem to external role
Karthikeyannhs 54f059f
code formating
Karthikeyannhs 90e414c
markdown fix
Karthikeyannhs cba485c
markdown fix
Karthikeyannhs adb247b
Merge branch 'main' into feature/ash-kt-eli-205-configure-provision-l…
Karthikeyannhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../_shared/default_variables.tf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| resource "aws_kms_key" "lambda_cmk" { | ||
| description = "${terraform.workspace == "default" ? "" : "${terraform.workspace}-"}${var.lambda_func_name} Master Key" | ||
| deletion_window_in_days = 14 | ||
| is_enabled = true | ||
| enable_key_rotation = true | ||
| tags = var.tags | ||
| } | ||
|
|
||
| resource "aws_kms_alias" "lambda_cmk" { | ||
| name = "alias/${terraform.workspace == "default" ? "" : "${terraform.workspace}-"}${var.lambda_func_name}-cmk" | ||
| target_key_id = aws_kms_key.lambda_cmk.key_id | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| resource "aws_lambda_function" "eligibility_signposting_lambda" { | ||
| # If the file is not in the current working directory you will need to include a | ||
| # path.module in the filename. | ||
| filename = var.file_name | ||
| function_name = var.lambda_func_name | ||
| role = var.eligibility_lambda_role_arn | ||
| handler = var.handler | ||
|
|
||
| source_code_hash = filebase64sha256(var.file_name) | ||
|
|
||
| runtime = "python3.13" | ||
| timeout = 30 | ||
| memory_size = 128 # Default | ||
|
|
||
| environment { | ||
| variables = { | ||
| ELIGIBILITY_TABLE_NAME = var.eligibility_status_table_name, | ||
| RULES_BUCKET_NAME = var.eligibility_rules_bucket_name, | ||
| ENV = var.environment | ||
| } | ||
| } | ||
| vpc_config { | ||
| subnet_ids = var.vpc_intra_subnets | ||
| security_group_ids = var.security_group_ids | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| output "aws_lambda_function_id" { | ||
| value = aws_lambda_function.eligibility_signposting_lambda.id | ||
| } | ||
| output "aws_lambda_function_arn" { | ||
| value = aws_lambda_function.eligibility_signposting_lambda.arn | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| variable "workspace" { | ||
| description = "Usually the developer short code or the name of the environment." | ||
| type = string | ||
| } | ||
|
|
||
| variable "eligibility_lambda_role_arn" { | ||
| description = "lambda read role arn for dynamodb" | ||
| type = string | ||
| } | ||
|
|
||
| variable "lambda_func_name" { | ||
| description = "Name of the Lambda function" | ||
| type = string | ||
| } | ||
|
|
||
| variable "vpc_intra_subnets" { | ||
| description = "vpc private subnets for lambda" | ||
| type = list(string) | ||
| } | ||
|
|
||
| variable "security_group_ids" { | ||
| description = "security groups for lambda" | ||
| type = list(string) | ||
| } | ||
|
|
||
| variable "file_name" { | ||
| description = "path of the the zipped lambda" | ||
| type = string | ||
| } | ||
|
|
||
| variable "handler" { | ||
| description = "lambda handler name" | ||
| type = string | ||
| } | ||
|
|
||
| variable "eligibility_rules_bucket_name" { | ||
| description = "campaign config rules bucket name" | ||
| type = string | ||
| } | ||
|
|
||
| variable "eligibility_status_table_name" { | ||
| description = "eligibility datastore table name" | ||
| type = string | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # CloudWatch Log Group for lambda Flow Logs | ||
| resource "aws_cloudwatch_log_group" "lambda_logs" { | ||
| name = "/aws/lambda/${module.eligibility_signposting_lambda_function.aws_lambda_function_id}" | ||
| retention_in_days = 14 | ||
|
|
||
| tags = { | ||
| Name = "lambda-execution-logs" | ||
| Stack = local.stack_name | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.