From 24c9612eabf8565bc0bb426c2d589b98bbf6d266 Mon Sep 17 00:00:00 2001 From: Nicolas Harlem Eide Date: Tue, 26 Mar 2024 13:09:07 +0100 Subject: [PATCH] Add an option to enable snap start --- main.tf | 8 ++++++++ variables.tf | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/main.tf b/main.tf index 7ecca92..0c76c02 100644 --- a/main.tf +++ b/main.tf @@ -40,6 +40,14 @@ resource "aws_lambda_function" "this" { publish = true + dynamic "snap_start" { + for_each = var.snap_start ? [{}] : [] + + content { + apply_on = "PublishedVersions" + } + } + tracing_config { mode = var.x_ray_mode } diff --git a/variables.tf b/variables.tf index f49b5e9..3d5b50f 100644 --- a/variables.tf +++ b/variables.tf @@ -84,6 +84,13 @@ variable "x_ray_mode" { default = "PassThrough" } +variable "snap_start" { + description = "Enable or disable snap start for the lambda function" + + type = bool + default = false +} + variable "provisioned_concurrency" { description = "Settings for provisioned concurrency"