Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 27acd86

Browse files
committedJan 11, 2025··
fix
1 parent 9618da5 commit 27acd86

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,10 @@ module "lambda_at_edge" {
344344
}]
345345
runtime = "nodejs16.x"
346346
handler = "index.handler"
347-
event_type = "origin-response"
348-
include_body = false
349347
memory_size = 128
350348
timeout = 3
349+
event_type = "origin-response"
350+
include_body = false
351351
}
352352
}
353353

‎README.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ usage: |2-
355355
}]
356356
runtime = "nodejs16.x"
357357
handler = "index.handler"
358-
event_type = "origin-response"
359-
include_body = false
360358
memory_size = 128
361359
timeout = 3
360+
event_type = "origin-response"
361+
include_body = false
362362
}
363363
}
364364

‎examples/complete/lambda-at-edge.tf

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,29 @@ module "lambda_at_edge" {
3232
}]
3333
runtime = "nodejs16.x"
3434
handler = "index.handler"
35-
event_type = "viewer-request"
36-
include_body = false
3735
memory_size = 128
3836
timeout = 3
37+
event_type = "viewer-request"
38+
include_body = false
3939
},
4040
# Add custom header to the response
4141
viewer_response = {
4242
source_dir = "lib"
4343
runtime = "nodejs16.x"
4444
handler = "index.handler"
45-
event_type = "viewer-response"
46-
include_body = false
4745
memory_size = 128
4846
timeout = 3
47+
event_type = "viewer-response"
48+
include_body = false
4949
},
5050
origin_request = {
5151
source_zip = "origin-request.zip"
5252
runtime = "nodejs16.x"
5353
handler = "index.handler"
54-
event_type = "origin-request"
55-
include_body = false
5654
memory_size = 128
5755
timeout = 3
56+
event_type = "origin-request"
57+
include_body = false
5858
},
5959
# Add security headers to the request from CF to the origin
6060
origin_response = {
@@ -85,10 +85,10 @@ module "lambda_at_edge" {
8585
}]
8686
runtime = "nodejs16.x"
8787
handler = "index.handler"
88-
event_type = "origin-response"
89-
include_body = false
9088
memory_size = 128
9189
timeout = 3
90+
event_type = "origin-response"
91+
include_body = false
9292
}
9393
}
9494

‎modules/lambda@edge/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module "lambda_at_edge" {
7373
| <a name="input_destruction_delay"></a> [destruction\_delay](#input\_destruction\_delay) | The delay, in [Golang ParseDuration](https://pkg.go.dev/time#ParseDuration) format, to wait before destroying the Lambda@Edge<br>functions.<br><br>This delay is meant to circumvent Lambda@Edge functions not being immediately deletable following their dissociation from<br>a CloudFront distribution, since they are replicated to CloudFront Edge servers around the world.<br><br>If set to `null`, no delay will be introduced.<br><br>By default, the delay is 20 minutes. This is because it takes about 3 minutes to destroy a CloudFront distribution, and<br>around 15 minutes until the Lambda@Edge function is available for deletion, in most cases.<br><br>For more information, see: https://github.com/hashicorp/terraform-provider-aws/issues/1721. | `string` | `"20m"` | no |
7474
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
7575
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
76-
| <a name="input_functions"></a> [functions](#input\_functions) | Lambda@Edge functions to create.<br><br>The key of this map is the name label of the Lambda@Edge function.<br><br>`source.filename` and `source.content` dictate the name and content of the files that will make up the Lambda function<br>source, respectively.<br><br>`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)<br>resource.<br><br>`event_type` and `include_body` correspond to the attributes of the same name in the [Lambda Function association block<br>of the cloudfront\_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#lambda-function-association)<br>resource. | <pre>map(object({<br> source = list(object({<br> filename = string<br> content = string<br> }))<br> runtime = string<br> handler = string<br> event_type = string<br> include_body = bool<br> }))</pre> | n/a | yes |
76+
| <a name="input_functions"></a> [functions](#input\_functions) | Lambda@Edge functions to create.<br><br>The key of this map is the name label of the Lambda@Edge function.<br><br>`source.filename` and `source.content` dictate the name and content of the files that will make up the Lambda function<br>source, respectively.<br><br>`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)<br>resource.<br><br>`event_type` and `include_body` correspond to the attributes of the same name in the [Lambda Function association block<br>of the cloudfront\_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#lambda-function-association)<br>resource. | <pre>map(object({<br> source = list(object({<br> filename = string<br> content = string<br> }))<br> runtime = string<br> handler = string<br> memory_size = number<br> timeout = number<br> event_type = string<br> include_body = bool<br> }))</pre> | n/a | yes |
7777
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
7878
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
7979
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |

‎modules/lambda@edge/main.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ resource "aws_lambda_function" "default" {
7878
function_name = module.function_label[each.key].id
7979
runtime = each.value.runtime
8080
handler = each.value.handler
81+
memory_size = each.value.memory_size != null ? each.value.memory_size : 128
82+
timeout = each.value.timeout != null ? each.value.timeout : 3
8183
role = module.role[each.key].arn
8284
filename = each.value.source_zip != null ? data.local_file.lambda_zip[each.key].filename : data.archive_file.lambda_zip[each.key].output_path
8385
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
8486
publish = true
85-
memory_size = each.value.memory_size != null ? each.value.memory_size : 128
86-
timeout = each.value.timeout != null ? each.value.timeout : 3
8787
}
8888

8989
resource "aws_lambda_permission" "allow_cloudfront" {

‎modules/lambda@edge/variables.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ variable "functions" {
2929
source_zip = optional(string)
3030
runtime = string
3131
handler = string
32-
event_type = string
33-
include_body = bool
3432
memory_size = optional(number)
3533
timeout = optional(number)
34+
event_type = string
35+
include_body = bool
3636
}))
3737

3838
validation {

0 commit comments

Comments
 (0)
Please sign in to comment.