Skip to content

Commit b9671e1

Browse files
feat: Added support for skip_destroy in Lambda Layer Version (terraform-aws-modules#244)
Co-authored-by: Anton Babenko <[email protected]>
1 parent b9684e4 commit b9671e1

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.58.0
3+
rev: v1.62.3
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -23,6 +23,6 @@ repos:
2323
- '--args=--only=terraform_standard_module_structure'
2424
- '--args=--only=terraform_workspace_remote'
2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.0.1
26+
rev: v4.1.0
2727
hooks:
2828
- id: check-merge-conflict

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo
592592
| Name | Version |
593593
|------|---------|
594594
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
595-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.61 |
595+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66 |
596596
| <a name="requirement_external"></a> [external](#requirement\_external) | >= 1 |
597597
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1 |
598598
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2 |
@@ -601,7 +601,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo
601601

602602
| Name | Version |
603603
|------|---------|
604-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.61 |
604+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.66 |
605605
| <a name="provider_external"></a> [external](#provider\_external) | >= 1 |
606606
| <a name="provider_local"></a> [local](#provider\_local) | >= 1 |
607607
| <a name="provider_null"></a> [null](#provider\_null) | >= 2 |
@@ -715,6 +715,7 @@ No modules.
715715
| <a name="input_lambda_at_edge"></a> [lambda\_at\_edge](#input\_lambda\_at\_edge) | Set this to true if using Lambda@Edge, to enable publishing, limit the timeout, and allow edgelambda.amazonaws.com to invoke the function | `bool` | `false` | no |
716716
| <a name="input_lambda_role"></a> [lambda\_role](#input\_lambda\_role) | IAM role ARN attached to the Lambda Function. This governs both who / what can invoke your Lambda Function, as well as what resources our Lambda Function has access to. See Lambda Permission Model for more details. | `string` | `""` | no |
717717
| <a name="input_layer_name"></a> [layer\_name](#input\_layer\_name) | Name of Lambda Layer to create | `string` | `""` | no |
718+
| <a name="input_layer_skip_destroy"></a> [layer\_skip\_destroy](#input\_layer\_skip\_destroy) | Whether to retain the old version of a previously deployed Lambda Layer. | `bool` | `false` | no |
718719
| <a name="input_layers"></a> [layers](#input\_layers) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function. | `list(string)` | `null` | no |
719720
| <a name="input_license_info"></a> [license\_info](#input\_license\_info) | License info for your Lambda Layer. Eg, MIT or full url of a license. | `string` | `""` | no |
720721
| <a name="input_local_existing_package"></a> [local\_existing\_package](#input\_local\_existing\_package) | The absolute path to an existing zip-file to use | `string` | `null` | no |

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ resource "aws_lambda_layer_version" "this" {
105105

106106
compatible_runtimes = length(var.compatible_runtimes) > 0 ? var.compatible_runtimes : [var.runtime]
107107
compatible_architectures = var.compatible_architectures
108+
skip_destroy = var.layer_skip_destroy
108109

109110
filename = local.filename
110111
source_code_hash = var.ignore_source_code_hash ? null : (local.filename == null ? false : fileexists(local.filename)) && !local.was_missing ? filebase64sha256(local.filename) : null

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ variable "layer_name" {
197197
default = ""
198198
}
199199

200+
variable "layer_skip_destroy" {
201+
description = "Whether to retain the old version of a previously deployed Lambda Layer."
202+
type = bool
203+
default = false
204+
}
205+
200206
variable "license_info" {
201207
description = "License info for your Lambda Layer. Eg, MIT or full url of a license."
202208
type = string

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_version = ">= 0.13.1"
33

44
required_providers {
5-
aws = ">= 3.61"
5+
aws = ">= 3.66"
66
external = ">= 1"
77
local = ">= 1"
88
null = ">= 2"

0 commit comments

Comments
 (0)