From a2d3444648b27619126fb362ba1851b5da63d1e4 Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Sat, 11 Jan 2025 09:36:07 +0000 Subject: [PATCH 1/9] memory and timeout vars for lambda@edge --- examples/complete/lambda-at-edge.tf | 3 +++ modules/lambda@edge/README.md | 2 ++ modules/lambda@edge/main.tf | 2 ++ modules/lambda@edge/variables.tf | 14 +++++++++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/complete/lambda-at-edge.tf b/examples/complete/lambda-at-edge.tf index cbdbbe2a..ee6120aa 100644 --- a/examples/complete/lambda-at-edge.tf +++ b/examples/complete/lambda-at-edge.tf @@ -87,6 +87,9 @@ module "lambda_at_edge" { # A destruction delay is always enabled due to automated tests (see variable description for more information). destruction_delay = "20m" + memory_size = 128 + timeout = 3 + providers = { aws = aws.us-east-1 } diff --git a/modules/lambda@edge/README.md b/modules/lambda@edge/README.md index 2b838c53..84708790 100644 --- a/modules/lambda@edge/README.md +++ b/modules/lambda@edge/README.md @@ -71,6 +71,8 @@ module "lambda_at_edge" { | [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | | [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
`labels` is a list of labels, in order, to pass to `format()` function.
Label values will be normalized before being passed to `format()` so they will be
identical to how they appear in `id`.
Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no | | [destruction\_delay](#input\_destruction\_delay) | The delay, in [Golang ParseDuration](https://pkg.go.dev/time#ParseDuration) format, to wait before destroying the Lambda@Edge
functions.

This delay is meant to circumvent Lambda@Edge functions not being immediately deletable following their dissociation from
a CloudFront distribution, since they are replicated to CloudFront Edge servers around the world.

If set to `null`, no delay will be introduced.

By default, the delay is 20 minutes. This is because it takes about 3 minutes to destroy a CloudFront distribution, and
around 15 minutes until the Lambda@Edge function is available for deletion, in most cases.

For more information, see: https://github.com/hashicorp/terraform-provider-aws/issues/1721. | `string` | `"20m"` | no | +| [memory\_size](#input\_memory\_size) | Amount of memory in MB the Lambda Function can use at runtime. | `number` | `128` | no | +| [timeout](#input\_timeout) | The amount of time the Lambda Function has to run in seconds. | `number` | `3` | no | | [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | | [functions](#input\_functions) | Lambda@Edge functions to create.

The key of this map is the name label of the Lambda@Edge function.

`source.filename` and `source.content` dictate the name and content of the files that will make up the Lambda function
source, respectively.

`runtime` and `handler` correspond to the attributes of the same name in the [lambda\_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function)
resource.

`event_type` and `include_body` correspond to the attributes of the same name in the [Lambda Function association block
of the cloudfront\_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#lambda-function-association)
resource. |
map(object({
source = list(object({
filename = string
content = string
}))
runtime = string
handler = string
event_type = string
include_body = bool
}))
| n/a | yes | diff --git a/modules/lambda@edge/main.tf b/modules/lambda@edge/main.tf index 985ecf7a..00a2bf21 100644 --- a/modules/lambda@edge/main.tf +++ b/modules/lambda@edge/main.tf @@ -82,6 +82,8 @@ resource "aws_lambda_function" "default" { filename = each.value.source_zip != null ? data.local_file.lambda_zip[each.key].filename : data.archive_file.lambda_zip[each.key].output_path source_code_hash = each.value.source_zip != null ? sha256(data.local_file.lambda_zip[each.key].content_base64) : data.archive_file.lambda_zip[each.key].output_base64sha256 publish = true + memory_size = var.memory_size + timeout = var.timeout } resource "aws_lambda_permission" "allow_cloudfront" { diff --git a/modules/lambda@edge/variables.tf b/modules/lambda@edge/variables.tf index 83cbaf61..66e5c4b3 100644 --- a/modules/lambda@edge/variables.tf +++ b/modules/lambda@edge/variables.tf @@ -61,4 +61,16 @@ variable "destruction_delay" { For more information, see: https://github.com/hashicorp/terraform-provider-aws/issues/1721. EOT default = "20m" -} \ No newline at end of file +} + +variable "memory_size" { + type = number + description = "Amount of memory in MB the Lambda Function can use at runtime." + default = 128 +} + +variable "timeout" { + type = number + description = "The amount of time the Lambda Function has to run in seconds." + default = 3 +} From a957c918c510cd7f023a247c6bb8398819667ba4 Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Sat, 11 Jan 2025 09:45:36 +0000 Subject: [PATCH 2/9] fix --- README.md | 2 ++ README.yaml | 2 ++ examples/complete/lambda-at-edge.tf | 11 ++++++++--- modules/lambda@edge/README.md | 2 -- modules/lambda@edge/main.tf | 4 ++-- modules/lambda@edge/variables.tf | 14 ++------------ 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0ea07060..396dcf93 100644 --- a/README.md +++ b/README.md @@ -346,6 +346,8 @@ module "lambda_at_edge" { handler = "index.handler" event_type = "origin-response" include_body = false + memory_size = 128 + timeout = 3 } } diff --git a/README.yaml b/README.yaml index 823d1def..17f23b51 100644 --- a/README.yaml +++ b/README.yaml @@ -357,6 +357,8 @@ usage: |2- handler = "index.handler" event_type = "origin-response" include_body = false + memory_size = 128 + timeout = 3 } } diff --git a/examples/complete/lambda-at-edge.tf b/examples/complete/lambda-at-edge.tf index ee6120aa..eca33a1c 100644 --- a/examples/complete/lambda-at-edge.tf +++ b/examples/complete/lambda-at-edge.tf @@ -34,6 +34,8 @@ module "lambda_at_edge" { handler = "index.handler" event_type = "viewer-request" include_body = false + memory_size = 128 + timeout = 3 }, # Add custom header to the response viewer_response = { @@ -42,6 +44,8 @@ module "lambda_at_edge" { handler = "index.handler" event_type = "viewer-response" include_body = false + memory_size = 128 + timeout = 3 }, origin_request = { source_zip = "origin-request.zip" @@ -49,6 +53,8 @@ module "lambda_at_edge" { handler = "index.handler" event_type = "origin-request" include_body = false + memory_size = 128 + timeout = 3 }, # Add security headers to the request from CF to the origin origin_response = { @@ -81,15 +87,14 @@ module "lambda_at_edge" { handler = "index.handler" event_type = "origin-response" include_body = false + memory_size = 128 + timeout = 3 } } # A destruction delay is always enabled due to automated tests (see variable description for more information). destruction_delay = "20m" - memory_size = 128 - timeout = 3 - providers = { aws = aws.us-east-1 } diff --git a/modules/lambda@edge/README.md b/modules/lambda@edge/README.md index 84708790..2b838c53 100644 --- a/modules/lambda@edge/README.md +++ b/modules/lambda@edge/README.md @@ -71,8 +71,6 @@ module "lambda_at_edge" { | [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | | [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
`labels` is a list of labels, in order, to pass to `format()` function.
Label values will be normalized before being passed to `format()` so they will be
identical to how they appear in `id`.
Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no | | [destruction\_delay](#input\_destruction\_delay) | The delay, in [Golang ParseDuration](https://pkg.go.dev/time#ParseDuration) format, to wait before destroying the Lambda@Edge
functions.

This delay is meant to circumvent Lambda@Edge functions not being immediately deletable following their dissociation from
a CloudFront distribution, since they are replicated to CloudFront Edge servers around the world.

If set to `null`, no delay will be introduced.

By default, the delay is 20 minutes. This is because it takes about 3 minutes to destroy a CloudFront distribution, and
around 15 minutes until the Lambda@Edge function is available for deletion, in most cases.

For more information, see: https://github.com/hashicorp/terraform-provider-aws/issues/1721. | `string` | `"20m"` | no | -| [memory\_size](#input\_memory\_size) | Amount of memory in MB the Lambda Function can use at runtime. | `number` | `128` | no | -| [timeout](#input\_timeout) | The amount of time the Lambda Function has to run in seconds. | `number` | `3` | no | | [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | | [functions](#input\_functions) | Lambda@Edge functions to create.

The key of this map is the name label of the Lambda@Edge function.

`source.filename` and `source.content` dictate the name and content of the files that will make up the Lambda function
source, respectively.

`runtime` and `handler` correspond to the attributes of the same name in the [lambda\_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function)
resource.

`event_type` and `include_body` correspond to the attributes of the same name in the [Lambda Function association block
of the cloudfront\_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#lambda-function-association)
resource. |
map(object({
source = list(object({
filename = string
content = string
}))
runtime = string
handler = string
event_type = string
include_body = bool
}))
| n/a | yes | diff --git a/modules/lambda@edge/main.tf b/modules/lambda@edge/main.tf index 00a2bf21..514b6002 100644 --- a/modules/lambda@edge/main.tf +++ b/modules/lambda@edge/main.tf @@ -82,8 +82,8 @@ resource "aws_lambda_function" "default" { filename = each.value.source_zip != null ? data.local_file.lambda_zip[each.key].filename : data.archive_file.lambda_zip[each.key].output_path source_code_hash = each.value.source_zip != null ? sha256(data.local_file.lambda_zip[each.key].content_base64) : data.archive_file.lambda_zip[each.key].output_base64sha256 publish = true - memory_size = var.memory_size - timeout = var.timeout + memory_size = each.value.memory_size != null ? each.value.memory_size : 128 + timeout = each.value.timeout != null ? each.value.timeout : 3 } resource "aws_lambda_permission" "allow_cloudfront" { diff --git a/modules/lambda@edge/variables.tf b/modules/lambda@edge/variables.tf index 66e5c4b3..fb319075 100644 --- a/modules/lambda@edge/variables.tf +++ b/modules/lambda@edge/variables.tf @@ -31,6 +31,8 @@ variable "functions" { handler = string event_type = string include_body = bool + memory_size = optional(number) + timeout = optional(number) })) validation { @@ -62,15 +64,3 @@ variable "destruction_delay" { EOT default = "20m" } - -variable "memory_size" { - type = number - description = "Amount of memory in MB the Lambda Function can use at runtime." - default = 128 -} - -variable "timeout" { - type = number - description = "The amount of time the Lambda Function has to run in seconds." - default = 3 -} From 2e205c74d1f05d7423b950cf44f7b012a6ca0eb2 Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Sat, 11 Jan 2025 09:46:06 +0000 Subject: [PATCH 3/9] fix --- modules/lambda@edge/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lambda@edge/main.tf b/modules/lambda@edge/main.tf index 514b6002..4ced1ee7 100644 --- a/modules/lambda@edge/main.tf +++ b/modules/lambda@edge/main.tf @@ -93,4 +93,4 @@ resource "aws_lambda_permission" "allow_cloudfront" { statement_id = "AllowExecutionFromCloudFront" action = "lambda:GetFunction" principal = "edgelambda.amazonaws.com" -} \ No newline at end of file +} From fb732be2c865ee6367647784b45b6a390a5149f8 Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Sat, 11 Jan 2025 09:46:30 +0000 Subject: [PATCH 4/9] fix --- modules/lambda@edge/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lambda@edge/variables.tf b/modules/lambda@edge/variables.tf index fb319075..2bbac438 100644 --- a/modules/lambda@edge/variables.tf +++ b/modules/lambda@edge/variables.tf @@ -63,4 +63,4 @@ variable "destruction_delay" { For more information, see: https://github.com/hashicorp/terraform-provider-aws/issues/1721. EOT default = "20m" -} +} \ No newline at end of file From 9618da587a8d77f3bc6a9f4c7034ccbce108f8cd Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Sat, 11 Jan 2025 09:47:03 +0000 Subject: [PATCH 5/9] fix --- modules/lambda@edge/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lambda@edge/main.tf b/modules/lambda@edge/main.tf index 4ced1ee7..514b6002 100644 --- a/modules/lambda@edge/main.tf +++ b/modules/lambda@edge/main.tf @@ -93,4 +93,4 @@ resource "aws_lambda_permission" "allow_cloudfront" { statement_id = "AllowExecutionFromCloudFront" action = "lambda:GetFunction" principal = "edgelambda.amazonaws.com" -} +} \ No newline at end of file From 27acd8610ee51cef3f93616f48a1ac0e3b8318f0 Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Sat, 11 Jan 2025 09:52:50 +0000 Subject: [PATCH 6/9] fix --- README.md | 4 ++-- README.yaml | 4 ++-- examples/complete/lambda-at-edge.tf | 16 ++++++++-------- modules/lambda@edge/README.md | 2 +- modules/lambda@edge/main.tf | 4 ++-- modules/lambda@edge/variables.tf | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 396dcf93..24b0b3d7 100644 --- a/README.md +++ b/README.md @@ -344,10 +344,10 @@ module "lambda_at_edge" { }] runtime = "nodejs16.x" handler = "index.handler" - event_type = "origin-response" - include_body = false memory_size = 128 timeout = 3 + event_type = "origin-response" + include_body = false } } diff --git a/README.yaml b/README.yaml index 17f23b51..795b7a53 100644 --- a/README.yaml +++ b/README.yaml @@ -355,10 +355,10 @@ usage: |2- }] runtime = "nodejs16.x" handler = "index.handler" - event_type = "origin-response" - include_body = false memory_size = 128 timeout = 3 + event_type = "origin-response" + include_body = false } } diff --git a/examples/complete/lambda-at-edge.tf b/examples/complete/lambda-at-edge.tf index eca33a1c..cb11a12a 100644 --- a/examples/complete/lambda-at-edge.tf +++ b/examples/complete/lambda-at-edge.tf @@ -32,29 +32,29 @@ module "lambda_at_edge" { }] runtime = "nodejs16.x" handler = "index.handler" - event_type = "viewer-request" - include_body = false memory_size = 128 timeout = 3 + event_type = "viewer-request" + include_body = false }, # Add custom header to the response viewer_response = { source_dir = "lib" runtime = "nodejs16.x" handler = "index.handler" - event_type = "viewer-response" - include_body = false memory_size = 128 timeout = 3 + event_type = "viewer-response" + include_body = false }, origin_request = { source_zip = "origin-request.zip" runtime = "nodejs16.x" handler = "index.handler" - event_type = "origin-request" - include_body = false memory_size = 128 timeout = 3 + event_type = "origin-request" + include_body = false }, # Add security headers to the request from CF to the origin origin_response = { @@ -85,10 +85,10 @@ module "lambda_at_edge" { }] runtime = "nodejs16.x" handler = "index.handler" - event_type = "origin-response" - include_body = false memory_size = 128 timeout = 3 + event_type = "origin-response" + include_body = false } } diff --git a/modules/lambda@edge/README.md b/modules/lambda@edge/README.md index 2b838c53..2071c500 100644 --- a/modules/lambda@edge/README.md +++ b/modules/lambda@edge/README.md @@ -73,7 +73,7 @@ module "lambda_at_edge" { | [destruction\_delay](#input\_destruction\_delay) | The delay, in [Golang ParseDuration](https://pkg.go.dev/time#ParseDuration) format, to wait before destroying the Lambda@Edge
functions.

This delay is meant to circumvent Lambda@Edge functions not being immediately deletable following their dissociation from
a CloudFront distribution, since they are replicated to CloudFront Edge servers around the world.

If set to `null`, no delay will be introduced.

By default, the delay is 20 minutes. This is because it takes about 3 minutes to destroy a CloudFront distribution, and
around 15 minutes until the Lambda@Edge function is available for deletion, in most cases.

For more information, see: https://github.com/hashicorp/terraform-provider-aws/issues/1721. | `string` | `"20m"` | no | | [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | -| [functions](#input\_functions) | Lambda@Edge functions to create.

The key of this map is the name label of the Lambda@Edge function.

`source.filename` and `source.content` dictate the name and content of the files that will make up the Lambda function
source, respectively.

`runtime` and `handler` correspond to the attributes of the same name in the [lambda\_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function)
resource.

`event_type` and `include_body` correspond to the attributes of the same name in the [Lambda Function association block
of the cloudfront\_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#lambda-function-association)
resource. |
map(object({
source = list(object({
filename = string
content = string
}))
runtime = string
handler = string
event_type = string
include_body = bool
}))
| n/a | yes | +| [functions](#input\_functions) | Lambda@Edge functions to create.

The key of this map is the name label of the Lambda@Edge function.

`source.filename` and `source.content` dictate the name and content of the files that will make up the Lambda function
source, respectively.

`runtime`, `handler`, `memory_size`, and `timeout` correspond to the attributes of the same name in the [lambda\_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function)
resource.

`event_type` and `include_body` correspond to the attributes of the same name in the [Lambda Function association block
of the cloudfront\_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#lambda-function-association)
resource. |
map(object({
source = list(object({
filename = string
content = string
}))
runtime = string
handler = string
memory_size = number
timeout = number
event_type = string
include_body = bool
}))
| n/a | yes | | [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | | [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.
Does not affect keys of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no | | [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no | diff --git a/modules/lambda@edge/main.tf b/modules/lambda@edge/main.tf index 514b6002..a48947df 100644 --- a/modules/lambda@edge/main.tf +++ b/modules/lambda@edge/main.tf @@ -78,12 +78,12 @@ resource "aws_lambda_function" "default" { function_name = module.function_label[each.key].id runtime = each.value.runtime handler = each.value.handler + memory_size = each.value.memory_size != null ? each.value.memory_size : 128 + timeout = each.value.timeout != null ? each.value.timeout : 3 role = module.role[each.key].arn filename = each.value.source_zip != null ? data.local_file.lambda_zip[each.key].filename : data.archive_file.lambda_zip[each.key].output_path source_code_hash = each.value.source_zip != null ? sha256(data.local_file.lambda_zip[each.key].content_base64) : data.archive_file.lambda_zip[each.key].output_base64sha256 publish = true - memory_size = each.value.memory_size != null ? each.value.memory_size : 128 - timeout = each.value.timeout != null ? each.value.timeout : 3 } resource "aws_lambda_permission" "allow_cloudfront" { diff --git a/modules/lambda@edge/variables.tf b/modules/lambda@edge/variables.tf index 2bbac438..b7a92236 100644 --- a/modules/lambda@edge/variables.tf +++ b/modules/lambda@edge/variables.tf @@ -29,10 +29,10 @@ variable "functions" { source_zip = optional(string) runtime = string handler = string - event_type = string - include_body = bool memory_size = optional(number) timeout = optional(number) + event_type = string + include_body = bool })) validation { From 8240280bfd2a1f2f5a8bb8bea36c73a80c08dc2a Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Mon, 13 Jan 2025 16:47:31 +0000 Subject: [PATCH 7/9] fix --- modules/lambda@edge/variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lambda@edge/variables.tf b/modules/lambda@edge/variables.tf index b7a92236..af76c78e 100644 --- a/modules/lambda@edge/variables.tf +++ b/modules/lambda@edge/variables.tf @@ -13,8 +13,8 @@ variable "functions" { `source_zip` contains path to zip file with lambda source. - `runtime` and `handler` correspond to the attributes of the same name in the [lambda_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) - resource. + `runtime`, `handler`, `memory_size` and `timeout` correspond to the attributes of the same name in the [lambda_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) + resource. See [here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-at-edge-function-restrictions.html) for Lambda@Edge function restrictions. `event_type` and `include_body` correspond to the attributes of the same name in the [Lambda Function association block of the cloudfront_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#lambda-function-association) From 4aff34b07bd14b1ddc0dac11587480e03c65c6ca Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Wed, 15 Jan 2025 16:25:05 +0000 Subject: [PATCH 8/9] fix --- modules/lambda@edge/main.tf | 4 ++-- modules/lambda@edge/variables.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/lambda@edge/main.tf b/modules/lambda@edge/main.tf index a48947df..c032d434 100644 --- a/modules/lambda@edge/main.tf +++ b/modules/lambda@edge/main.tf @@ -78,8 +78,8 @@ resource "aws_lambda_function" "default" { function_name = module.function_label[each.key].id runtime = each.value.runtime handler = each.value.handler - memory_size = each.value.memory_size != null ? each.value.memory_size : 128 - timeout = each.value.timeout != null ? each.value.timeout : 3 + memory_size = each.value.memory_size + timeout = each.value.timeout role = module.role[each.key].arn filename = each.value.source_zip != null ? data.local_file.lambda_zip[each.key].filename : data.archive_file.lambda_zip[each.key].output_path source_code_hash = each.value.source_zip != null ? sha256(data.local_file.lambda_zip[each.key].content_base64) : data.archive_file.lambda_zip[each.key].output_base64sha256 diff --git a/modules/lambda@edge/variables.tf b/modules/lambda@edge/variables.tf index af76c78e..ddf4074b 100644 --- a/modules/lambda@edge/variables.tf +++ b/modules/lambda@edge/variables.tf @@ -29,8 +29,8 @@ variable "functions" { source_zip = optional(string) runtime = string handler = string - memory_size = optional(number) - timeout = optional(number) + memory_size = number + timeout = number event_type = string include_body = bool })) From 882483083d8fb3209ee40e997f459e0d667390de Mon Sep 17 00:00:00 2001 From: Mihai PLESA Date: Wed, 15 Jan 2025 16:28:06 +0000 Subject: [PATCH 9/9] fix --- modules/lambda@edge/variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lambda@edge/variables.tf b/modules/lambda@edge/variables.tf index ddf4074b..b1a529f0 100644 --- a/modules/lambda@edge/variables.tf +++ b/modules/lambda@edge/variables.tf @@ -29,8 +29,8 @@ variable "functions" { source_zip = optional(string) runtime = string handler = string - memory_size = number - timeout = number + memory_size = optional(number, 128) + timeout = optional(number, 3) event_type = string include_body = bool }))