Skip to content

Commit

Permalink
feat: Added support for skip_destroy in Lambda Layer Version (#244)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Babenko <anton@antonbabenko.com>
  • Loading branch information
absa-rsuarez and antonbabenko committed Jan 6, 2022
1 parent b9684e4 commit b9671e1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.58.0
rev: v1.62.3
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand All @@ -23,6 +23,6 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-merge-conflict
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.61 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66 |
| <a name="requirement_external"></a> [external](#requirement\_external) | >= 1 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2 |
Expand All @@ -601,7 +601,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.61 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.66 |
| <a name="provider_external"></a> [external](#provider\_external) | >= 1 |
| <a name="provider_local"></a> [local](#provider\_local) | >= 1 |
| <a name="provider_null"></a> [null](#provider\_null) | >= 2 |
Expand Down Expand Up @@ -715,6 +715,7 @@ No modules.
| <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 |
| <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 |
| <a name="input_layer_name"></a> [layer\_name](#input\_layer\_name) | Name of Lambda Layer to create | `string` | `""` | no |
| <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 |
| <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 |
| <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 |
| <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 |
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ resource "aws_lambda_layer_version" "this" {

compatible_runtimes = length(var.compatible_runtimes) > 0 ? var.compatible_runtimes : [var.runtime]
compatible_architectures = var.compatible_architectures
skip_destroy = var.layer_skip_destroy

filename = local.filename
source_code_hash = var.ignore_source_code_hash ? null : (local.filename == null ? false : fileexists(local.filename)) && !local.was_missing ? filebase64sha256(local.filename) : null
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ variable "layer_name" {
default = ""
}

variable "layer_skip_destroy" {
description = "Whether to retain the old version of a previously deployed Lambda Layer."
type = bool
default = false
}

variable "license_info" {
description = "License info for your Lambda Layer. Eg, MIT or full url of a license."
type = string
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.61"
aws = ">= 3.66"
external = ">= 1"
local = ">= 1"
null = ">= 2"
Expand Down

0 comments on commit b9671e1

Please sign in to comment.