Skip to content

Commit 582013a

Browse files
NixM0nk3yNick Gregoryantonbabenko
authored
feat: Add support for durable lambda feature (#731)
Co-authored-by: Nick Gregory <[email protected]> Co-authored-by: Anton Babenko <[email protected]>
1 parent 650141f commit 582013a

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,8 @@ No modules.
779779
| <a name="input_docker_image"></a> [docker\_image](#input\_docker\_image) | Docker image to use for the build | `string` | `""` | no |
780780
| <a name="input_docker_pip_cache"></a> [docker\_pip\_cache](#input\_docker\_pip\_cache) | Whether to mount a shared pip cache folder into docker environment or not | `any` | `null` | no |
781781
| <a name="input_docker_with_ssh_agent"></a> [docker\_with\_ssh\_agent](#input\_docker\_with\_ssh\_agent) | Whether to pass SSH\_AUTH\_SOCK into docker environment or not | `bool` | `false` | no |
782+
| <a name="input_durable_config_execution_timeout"></a> [durable\_config\_execution\_timeout](#input\_durable\_config\_execution\_timeout) | Maximum execution time in seconds for the durable function. Valid values between 1 and 31622400 (366 days). | `number` | `null` | no |
783+
| <a name="input_durable_config_retention_period"></a> [durable\_config\_retention\_period](#input\_durable\_config\_retention\_period) | Number of days to retain the function's execution state. Valid values between 1 and 90. Defaults to 14 if durable\_config is enabled. | `number` | `null` | no |
782784
| <a name="input_environment_variables"></a> [environment\_variables](#input\_environment\_variables) | A map that defines environment variables for the Lambda Function. | `map(string)` | `{}` | no |
783785
| <a name="input_ephemeral_storage_size"></a> [ephemeral\_storage\_size](#input\_ephemeral\_storage\_size) | Amount of ephemeral storage (/tmp) in MB your Lambda Function can use at runtime. Valid value between 512 MB to 10,240 MB (10 GB). | `number` | `512` | no |
784786
| <a name="input_event_source_mapping"></a> [event\_source\_mapping](#input\_event\_source\_mapping) | Map of event source mapping | `any` | `{}` | no |

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ resource "aws_lambda_function" "this" {
146146
}
147147
}
148148

149+
dynamic "durable_config" {
150+
for_each = var.durable_config_execution_timeout != null ? [true] : []
151+
152+
content {
153+
execution_timeout = var.durable_config_execution_timeout
154+
retention_period = var.durable_config_retention_period
155+
}
156+
}
157+
149158
dynamic "timeouts" {
150159
for_each = length(var.timeouts) > 0 ? [true] : []
151160

variables.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,3 +861,19 @@ variable "recursive_loop" {
861861
type = string
862862
default = null
863863
}
864+
865+
############################################
866+
# Lambda Durable Execution Settings
867+
############################################
868+
869+
variable "durable_config_execution_timeout" {
870+
description = "Maximum execution time in seconds for the durable function. Valid values between 1 and 31622400 (366 days)."
871+
type = number
872+
default = null
873+
}
874+
875+
variable "durable_config_retention_period" {
876+
description = "Number of days to retain the function's execution state. Valid values between 1 and 90. Defaults to 14 if durable_config is enabled."
877+
type = number
878+
default = null
879+
}

wrappers/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ module "wrapper" {
5454
docker_image = try(each.value.docker_image, var.defaults.docker_image, "")
5555
docker_pip_cache = try(each.value.docker_pip_cache, var.defaults.docker_pip_cache, null)
5656
docker_with_ssh_agent = try(each.value.docker_with_ssh_agent, var.defaults.docker_with_ssh_agent, false)
57+
durable_config_execution_timeout = try(each.value.durable_config_execution_timeout, var.defaults.durable_config_execution_timeout, null)
58+
durable_config_retention_period = try(each.value.durable_config_retention_period, var.defaults.durable_config_retention_period, null)
5759
environment_variables = try(each.value.environment_variables, var.defaults.environment_variables, {})
5860
ephemeral_storage_size = try(each.value.ephemeral_storage_size, var.defaults.ephemeral_storage_size, 512)
5961
event_source_mapping = try(each.value.event_source_mapping, var.defaults.event_source_mapping, {})

0 commit comments

Comments
 (0)