From 70328bc3a157e5af6327b065c9665570a0b27315 Mon Sep 17 00:00:00 2001 From: Vitaliy Markitanov <9357021+vit100@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:25:44 -0400 Subject: [PATCH 1/2] Updated description of parameter function_name. Value can be either a name or an ARN, it is also a required parameter. Slightly corrected grammar. --- modules/alias/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/alias/README.md b/modules/alias/README.md index 5ee31171..3988e28b 100644 --- a/modules/alias/README.md +++ b/modules/alias/README.md @@ -1,15 +1,15 @@ # AWS Lambda Alias -Terraform module, which creates Lambda alias as well as takes care of async event configuration and Lambda permissions for alias. +Terraform module, which creates a Lambda alias as well as takes care of async event configuration and Lambda permissions for the alias. -Lambda Alias is required to do complex Lambda deployments, eg. using external tools like AWS CodeDeploy. +Lambda Alias is required to do complex Lambda deployments, e.g., using external tools like AWS CodeDeploy. -This Terraform module is the part of [serverless.tf framework](https://github.com/antonbabenko/serverless.tf), which aims to simplify all operations when working with the serverless in Terraform. +This Terraform module is part of [serverless.tf framework](https://github.com/antonbabenko/serverless.tf), which aims to simplify all operations when working with serverless in Terraform. ## Usage -### Lambda Function and statically configured alias with the version of Lambda Function +### Lambda Function and statically configured alias with the version of the Lambda Function ```hcl module "lambda_function" { @@ -43,7 +43,7 @@ module "alias_no_refresh" { ### Lambda Alias (auto-refreshing when version changed externally) -This is useful when doing complex deployments using external tool. +This is useful when doing complex deployments using an external tool. ```hcl module "alias_refresh" { @@ -56,7 +56,7 @@ module "alias_refresh" { ### Lambda Alias (using existing alias) -This is useful when extra configuration on existing Lambda alias is required. +This is useful when extra configuration on the existing Lambda alias is required. ```hcl module "alias_refresh" { @@ -86,7 +86,7 @@ module "alias_existing" { ## Conditional creation -Sometimes you need to have a way to create resources conditionally but Terraform does not allow usage of `count` inside `module` block, so the solution is to specify `create` arguments. +Sometimes you need to have a way to create resources conditionally, but Terraform does not allow the usage of `count` inside `module` block, so the solution is to specify `create` arguments. ```hcl module "lambda" { @@ -155,7 +155,7 @@ No modules. | [destination\_on\_failure](#input\_destination\_on\_failure) | Amazon Resource Name (ARN) of the destination resource for failed asynchronous invocations | `string` | `null` | no | | [destination\_on\_success](#input\_destination\_on\_success) | Amazon Resource Name (ARN) of the destination resource for successful asynchronous invocations | `string` | `null` | no | | [event\_source\_mapping](#input\_event\_source\_mapping) | Map of event source mapping | `any` | `{}` | no | -| [function\_name](#input\_function\_name) | The function ARN of the Lambda function for which you want to create an alias. | `string` | `""` | no | +| [function\_name](#input\_function\_name) | Name or ARN of the Lambda function for which you want to create an alias. | `string` | `""` | yes | | [function\_version](#input\_function\_version) | Lambda function version for which you are creating the alias. Pattern: ($LATEST\|[0-9]+). | `string` | `""` | no | | [maximum\_event\_age\_in\_seconds](#input\_maximum\_event\_age\_in\_seconds) | Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. | `number` | `null` | no | | [maximum\_retry\_attempts](#input\_maximum\_retry\_attempts) | Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. | `number` | `null` | no | From 649eabeea52620bc29f7dd39ff286f1612a3b5aa Mon Sep 17 00:00:00 2001 From: Vitaliy Markitanov Date: Fri, 17 Oct 2025 12:45:14 -0400 Subject: [PATCH 2/2] fix: Update function_name description and default value in alias module. Regenerated doc files. --- modules/alias/README.md | 2 +- modules/alias/variables.tf | 3 +-- wrappers/alias/main.tf | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/alias/README.md b/modules/alias/README.md index 3988e28b..be12e936 100644 --- a/modules/alias/README.md +++ b/modules/alias/README.md @@ -155,7 +155,7 @@ No modules. | [destination\_on\_failure](#input\_destination\_on\_failure) | Amazon Resource Name (ARN) of the destination resource for failed asynchronous invocations | `string` | `null` | no | | [destination\_on\_success](#input\_destination\_on\_success) | Amazon Resource Name (ARN) of the destination resource for successful asynchronous invocations | `string` | `null` | no | | [event\_source\_mapping](#input\_event\_source\_mapping) | Map of event source mapping | `any` | `{}` | no | -| [function\_name](#input\_function\_name) | Name or ARN of the Lambda function for which you want to create an alias. | `string` | `""` | yes | +| [function\_name](#input\_function\_name) | Name or ARN of the Lambda function for which you want to create an alias. | `string` | n/a | yes | | [function\_version](#input\_function\_version) | Lambda function version for which you are creating the alias. Pattern: ($LATEST\|[0-9]+). | `string` | `""` | no | | [maximum\_event\_age\_in\_seconds](#input\_maximum\_event\_age\_in\_seconds) | Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. | `number` | `null` | no | | [maximum\_retry\_attempts](#input\_maximum\_retry\_attempts) | Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. | `number` | `null` | no | diff --git a/modules/alias/variables.tf b/modules/alias/variables.tf index 732067f6..e666a91c 100644 --- a/modules/alias/variables.tf +++ b/modules/alias/variables.tf @@ -63,9 +63,8 @@ variable "description" { } variable "function_name" { - description = "The function ARN of the Lambda function for which you want to create an alias." + description = "Name or ARN of the Lambda function for which you want to create an alias." type = string - default = "" } variable "function_version" { diff --git a/wrappers/alias/main.tf b/wrappers/alias/main.tf index 7729dd06..f0805708 100644 --- a/wrappers/alias/main.tf +++ b/wrappers/alias/main.tf @@ -14,7 +14,7 @@ module "wrapper" { destination_on_failure = try(each.value.destination_on_failure, var.defaults.destination_on_failure, null) destination_on_success = try(each.value.destination_on_success, var.defaults.destination_on_success, null) event_source_mapping = try(each.value.event_source_mapping, var.defaults.event_source_mapping, {}) - function_name = try(each.value.function_name, var.defaults.function_name, "") + function_name = try(each.value.function_name, var.defaults.function_name) function_version = try(each.value.function_version, var.defaults.function_version, "") maximum_event_age_in_seconds = try(each.value.maximum_event_age_in_seconds, var.defaults.maximum_event_age_in_seconds, null) maximum_retry_attempts = try(each.value.maximum_retry_attempts, var.defaults.maximum_retry_attempts, null)