diff --git a/scripts/docker/examples/python/assets/hello_world/requirements.txt b/scripts/docker/examples/python/assets/hello_world/requirements.txt index ae33eb7..6f24cec 100644 --- a/scripts/docker/examples/python/assets/hello_world/requirements.txt +++ b/scripts/docker/examples/python/assets/hello_world/requirements.txt @@ -3,7 +3,7 @@ click==8.1.7 Flask-WTF==1.2.0 Flask==2.3.3 itsdangerous==2.1.2 -Jinja2==3.1.2 +Jinja2==3.1.3 MarkupSafe==2.1.3 pip==23.1.2 setuptools==65.5.1 diff --git a/terraform/main.tf b/terraform/main.tf index 7f6f1c7..f64bb70 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -34,6 +34,15 @@ resource "aws_lambda_function" "get_method_lambda" { variables = var.lambda_environment_variables } } + + dynamic "vpc_config" { + for_each = length(keys(var.lambda_vpc_config)) == 0 ? [] : [true] + content { + subnet_ids = var.lambda_vpc_config.subnet_ids + security_group_ids = var.lambda_vpc_config.security_group_ids + } + } + } resource "aws_cloudwatch_log_group" "get_method_lambda_log_group" { @@ -59,7 +68,7 @@ resource "aws_apigatewayv2_integration" "get_method_lambda_integration" { resource "aws_apigatewayv2_route" "get_method_route" { api_id = aws_apigatewayv2_api.get_method_api.id - route_key = "GET /" + route_key = "${var.api_route_method} ${var.api_route_path}" target = "integrations/${aws_apigatewayv2_integration.get_method_lambda_integration.id}" } diff --git a/terraform/variables.tf b/terraform/variables.tf index 0869656..3ce0ed2 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -68,3 +68,28 @@ variable "log_retention_days" { description = "The number of days to retain log events in the CloudWatch Logs Log Group." default = 14 } + +variable "lambda_vpc_config" { + description = "VPC configuration for the Lambda function." + type = object({ + security_group_ids = list(string) + subnet_ids = list(string) + }) + default = { + security_group_ids = [] + subnet_ids = [] + } +} + +variable "api_route_method" { + description = "The route method for the API Gateway." + type = string + default = "GET" +} + +variable "api_route_path" { + description = "The path for the API Gateway." + type = string + default = "/" + +}