From 107be19dcac01ec74e96180353b5e6ff58c3d865 Mon Sep 17 00:00:00 2001 From: Sebastian Czech Date: Sat, 25 Jan 2025 21:51:48 +0100 Subject: [PATCH 1/6] Make default tag terraform-aws-modules lambda optional --- README.md | 1 + main.tf | 2 +- variables.tf | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed1f32c8..db6fce21 100644 --- a/README.md +++ b/README.md @@ -773,6 +773,7 @@ No modules. | [create\_unqualified\_alias\_async\_event\_config](#input\_create\_unqualified\_alias\_async\_event\_config) | Whether to allow async event configuration on unqualified alias pointing to $LATEST version | `bool` | `true` | no | | [create\_unqualified\_alias\_lambda\_function\_url](#input\_create\_unqualified\_alias\_lambda\_function\_url) | Whether to use unqualified alias pointing to $LATEST version in Lambda Function URL | `bool` | `true` | no | | [dead\_letter\_target\_arn](#input\_dead\_letter\_target\_arn) | The ARN of an SNS topic or SQS queue to notify when an invocation fails. | `string` | `null` | no | +| [default\_tf\_aws\_modules\_tag](#input\_default\_tf\_aws\_modules\_tag) | Set to false to not include the default tag for all AWS modules. | `bool` | `true` | no | | [description](#input\_description) | Description of your Lambda Function (or Layer) | `string` | `""` | no | | [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 | diff --git a/main.tf b/main.tf index 6c3f0940..d493c3ab 100644 --- a/main.tf +++ b/main.tf @@ -138,7 +138,7 @@ resource "aws_lambda_function" "this" { } tags = merge( - { terraform-aws-modules = "lambda" }, + var.default_tf_aws_modules_tag ? { terraform-aws-modules = "lambda" } : {}, var.tags, var.function_tags ) diff --git a/variables.tf b/variables.tf index c4aac208..fea80848 100644 --- a/variables.tf +++ b/variables.tf @@ -188,6 +188,12 @@ variable "tags" { default = {} } +variable "default_tf_aws_modules_tag" { + description = "Set to false to not include the default tag for all AWS modules." + type = bool + default = true +} + variable "function_tags" { description = "A map of tags to assign only to the lambda function" type = map(string) From ca86ea45b32a2b3d7abd15ee6a3d66c5369e5663 Mon Sep 17 00:00:00 2001 From: Sebastian Czech Date: Sat, 25 Jan 2025 22:09:28 +0100 Subject: [PATCH 2/6] Update wrappers --- wrappers/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/wrappers/main.tf b/wrappers/main.tf index d1acc1cf..fd46f748 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -43,6 +43,7 @@ module "wrapper" { create_unqualified_alias_async_event_config = try(each.value.create_unqualified_alias_async_event_config, var.defaults.create_unqualified_alias_async_event_config, true) create_unqualified_alias_lambda_function_url = try(each.value.create_unqualified_alias_lambda_function_url, var.defaults.create_unqualified_alias_lambda_function_url, true) dead_letter_target_arn = try(each.value.dead_letter_target_arn, var.defaults.dead_letter_target_arn, null) + default_tf_aws_modules_tag = try(each.value.default_tf_aws_modules_tag, var.defaults.default_tf_aws_modules_tag, true) description = try(each.value.description, var.defaults.description, "") 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) From 044510299f8d5c2a1e2f390878229e7bdd09466c Mon Sep 17 00:00:00 2001 From: Sebastian Czech Date: Sat, 25 Jan 2025 22:20:50 +0100 Subject: [PATCH 3/6] Rename variable Co-authored-by: Anton Babenko --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index fea80848..d5bfacb9 100644 --- a/variables.tf +++ b/variables.tf @@ -188,7 +188,7 @@ variable "tags" { default = {} } -variable "default_tf_aws_modules_tag" { +variable "include_default_tag" { description = "Set to false to not include the default tag for all AWS modules." type = bool default = true From decdc8bbc16ad14b39caa77bb7c2396f45d04661 Mon Sep 17 00:00:00 2001 From: Sebastian Czech Date: Sat, 25 Jan 2025 22:30:18 +0100 Subject: [PATCH 4/6] Use renamed variable include_default_tag --- README.md | 2 +- main.tf | 2 +- wrappers/main.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index db6fce21..4a081d52 100644 --- a/README.md +++ b/README.md @@ -773,7 +773,6 @@ No modules. | [create\_unqualified\_alias\_async\_event\_config](#input\_create\_unqualified\_alias\_async\_event\_config) | Whether to allow async event configuration on unqualified alias pointing to $LATEST version | `bool` | `true` | no | | [create\_unqualified\_alias\_lambda\_function\_url](#input\_create\_unqualified\_alias\_lambda\_function\_url) | Whether to use unqualified alias pointing to $LATEST version in Lambda Function URL | `bool` | `true` | no | | [dead\_letter\_target\_arn](#input\_dead\_letter\_target\_arn) | The ARN of an SNS topic or SQS queue to notify when an invocation fails. | `string` | `null` | no | -| [default\_tf\_aws\_modules\_tag](#input\_default\_tf\_aws\_modules\_tag) | Set to false to not include the default tag for all AWS modules. | `bool` | `true` | no | | [description](#input\_description) | Description of your Lambda Function (or Layer) | `string` | `""` | no | | [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 | @@ -798,6 +797,7 @@ No modules. | [image\_config\_entry\_point](#input\_image\_config\_entry\_point) | The ENTRYPOINT for the docker image | `list(string)` | `[]` | no | | [image\_config\_working\_directory](#input\_image\_config\_working\_directory) | The working directory for the docker image | `string` | `null` | no | | [image\_uri](#input\_image\_uri) | The ECR image URI containing the function's deployment package. | `string` | `null` | no | +| [include\_default\_tag](#input\_include\_default\_tag) | Set to false to not include the default tag for all AWS modules. | `bool` | `true` | no | | [invoke\_mode](#input\_invoke\_mode) | Invoke mode of the Lambda Function URL. Valid values are BUFFERED (default) and RESPONSE\_STREAM. | `string` | `null` | no | | [ipv6\_allowed\_for\_dual\_stack](#input\_ipv6\_allowed\_for\_dual\_stack) | Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets | `bool` | `null` | no | | [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of KMS key to use by your Lambda Function | `string` | `null` | no | diff --git a/main.tf b/main.tf index d493c3ab..c67f1bbb 100644 --- a/main.tf +++ b/main.tf @@ -138,7 +138,7 @@ resource "aws_lambda_function" "this" { } tags = merge( - var.default_tf_aws_modules_tag ? { terraform-aws-modules = "lambda" } : {}, + var.include_default_tag ? { terraform-aws-modules = "lambda" } : {}, var.tags, var.function_tags ) diff --git a/wrappers/main.tf b/wrappers/main.tf index fd46f748..1092b4d3 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -43,7 +43,6 @@ module "wrapper" { create_unqualified_alias_async_event_config = try(each.value.create_unqualified_alias_async_event_config, var.defaults.create_unqualified_alias_async_event_config, true) create_unqualified_alias_lambda_function_url = try(each.value.create_unqualified_alias_lambda_function_url, var.defaults.create_unqualified_alias_lambda_function_url, true) dead_letter_target_arn = try(each.value.dead_letter_target_arn, var.defaults.dead_letter_target_arn, null) - default_tf_aws_modules_tag = try(each.value.default_tf_aws_modules_tag, var.defaults.default_tf_aws_modules_tag, true) description = try(each.value.description, var.defaults.description, "") 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) @@ -68,6 +67,7 @@ module "wrapper" { image_config_entry_point = try(each.value.image_config_entry_point, var.defaults.image_config_entry_point, []) image_config_working_directory = try(each.value.image_config_working_directory, var.defaults.image_config_working_directory, null) image_uri = try(each.value.image_uri, var.defaults.image_uri, null) + include_default_tag = try(each.value.include_default_tag, var.defaults.include_default_tag, true) invoke_mode = try(each.value.invoke_mode, var.defaults.invoke_mode, null) ipv6_allowed_for_dual_stack = try(each.value.ipv6_allowed_for_dual_stack, var.defaults.ipv6_allowed_for_dual_stack, null) kms_key_arn = try(each.value.kms_key_arn, var.defaults.kms_key_arn, null) From 8c5a1f034d35ee1228ebb611fa22fda4a688be51 Mon Sep 17 00:00:00 2001 From: Sebastian Czech Date: Sat, 25 Jan 2025 22:33:11 +0100 Subject: [PATCH 5/6] Update variable description --- README.md | 2 +- variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4a081d52..082022e1 100644 --- a/README.md +++ b/README.md @@ -797,7 +797,7 @@ No modules. | [image\_config\_entry\_point](#input\_image\_config\_entry\_point) | The ENTRYPOINT for the docker image | `list(string)` | `[]` | no | | [image\_config\_working\_directory](#input\_image\_config\_working\_directory) | The working directory for the docker image | `string` | `null` | no | | [image\_uri](#input\_image\_uri) | The ECR image URI containing the function's deployment package. | `string` | `null` | no | -| [include\_default\_tag](#input\_include\_default\_tag) | Set to false to not include the default tag for all AWS modules. | `bool` | `true` | no | +| [include\_default\_tag](#input\_include\_default\_tag) | Set to false to not include the default tags in the tags map. | `bool` | `true` | no | | [invoke\_mode](#input\_invoke\_mode) | Invoke mode of the Lambda Function URL. Valid values are BUFFERED (default) and RESPONSE\_STREAM. | `string` | `null` | no | | [ipv6\_allowed\_for\_dual\_stack](#input\_ipv6\_allowed\_for\_dual\_stack) | Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets | `bool` | `null` | no | | [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of KMS key to use by your Lambda Function | `string` | `null` | no | diff --git a/variables.tf b/variables.tf index d5bfacb9..37ac6a6f 100644 --- a/variables.tf +++ b/variables.tf @@ -189,7 +189,7 @@ variable "tags" { } variable "include_default_tag" { - description = "Set to false to not include the default tag for all AWS modules." + description = "Set to false to not include the default tags in the tags map." type = bool default = true } From 567c9af597af0848287c9f2e4b74e6da7542c16a Mon Sep 17 00:00:00 2001 From: Sebastian Czech Date: Sat, 25 Jan 2025 23:08:22 +0100 Subject: [PATCH 6/6] Update variable description --- README.md | 2 +- variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 082022e1..10cdbe39 100644 --- a/README.md +++ b/README.md @@ -797,7 +797,7 @@ No modules. | [image\_config\_entry\_point](#input\_image\_config\_entry\_point) | The ENTRYPOINT for the docker image | `list(string)` | `[]` | no | | [image\_config\_working\_directory](#input\_image\_config\_working\_directory) | The working directory for the docker image | `string` | `null` | no | | [image\_uri](#input\_image\_uri) | The ECR image URI containing the function's deployment package. | `string` | `null` | no | -| [include\_default\_tag](#input\_include\_default\_tag) | Set to false to not include the default tags in the tags map. | `bool` | `true` | no | +| [include\_default\_tag](#input\_include\_default\_tag) | Set to false to not include the default tag in the tags map. | `bool` | `true` | no | | [invoke\_mode](#input\_invoke\_mode) | Invoke mode of the Lambda Function URL. Valid values are BUFFERED (default) and RESPONSE\_STREAM. | `string` | `null` | no | | [ipv6\_allowed\_for\_dual\_stack](#input\_ipv6\_allowed\_for\_dual\_stack) | Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets | `bool` | `null` | no | | [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of KMS key to use by your Lambda Function | `string` | `null` | no | diff --git a/variables.tf b/variables.tf index 37ac6a6f..c71f68ae 100644 --- a/variables.tf +++ b/variables.tf @@ -189,7 +189,7 @@ variable "tags" { } variable "include_default_tag" { - description = "Set to false to not include the default tags in the tags map." + description = "Set to false to not include the default tag in the tags map." type = bool default = true }