Skip to content

Commit 610d602

Browse files
authored
feat: Allows tags to be provided only to the function (terraform-aws-modules#508)
Co-authored-by: Mike Carey <mike-carey@users.noreply.github.com>
1 parent e2500c0 commit 610d602

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ No modules.
789789
| <a name="input_file_system_arn"></a> [file\_system\_arn](#input\_file\_system\_arn) | The Amazon Resource Name (ARN) of the Amazon EFS Access Point that provides access to the file system. | `string` | `null` | no |
790790
| <a name="input_file_system_local_mount_path"></a> [file\_system\_local\_mount\_path](#input\_file\_system\_local\_mount\_path) | The path where the function can access the file system, starting with /mnt/. | `string` | `null` | no |
791791
| <a name="input_function_name"></a> [function\_name](#input\_function\_name) | A unique name for your Lambda Function | `string` | `""` | no |
792+
| <a name="input_function_tags"></a> [function\_tags](#input\_function\_tags) | A map of tags to assign only to the lambda function | `map(string)` | `{}` | no |
792793
| <a name="input_handler"></a> [handler](#input\_handler) | Lambda Function entrypoint in your code | `string` | `""` | no |
793794
| <a name="input_hash_extra"></a> [hash\_extra](#input\_hash\_extra) | The string to add into hashing function. Useful when building same source path for different functions. | `string` | `""` | no |
794795
| <a name="input_ignore_source_code_hash"></a> [ignore\_source\_code\_hash](#input\_ignore\_source\_code\_hash) | Whether to ignore changes to the function's source code hash. Set to true if you manage infrastructure and code deployments separately. | `bool` | `false` | no |

examples/complete/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ module "lambda_function" {
172172
delete = "20m"
173173
}
174174

175+
function_tags = {
176+
Language = "python"
177+
}
178+
175179
tags = {
176180
Module = "lambda1"
177181
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ resource "aws_lambda_function" "this" {
118118
delete = try(var.timeouts.delete, null)
119119
}
120120

121-
tags = var.tags
121+
tags = merge(var.tags, var.function_tags)
122122

123123
depends_on = [
124124
null_resource.archive,

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ variable "tags" {
182182
default = {}
183183
}
184184

185+
variable "function_tags" {
186+
description = "A map of tags to assign only to the lambda function"
187+
type = map(string)
188+
default = {}
189+
}
190+
185191
variable "s3_object_tags" {
186192
description = "A map of tags to assign to S3 bucket object."
187193
type = map(string)

wrappers/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module "wrapper" {
3333
vpc_subnet_ids = try(each.value.vpc_subnet_ids, var.defaults.vpc_subnet_ids, null)
3434
vpc_security_group_ids = try(each.value.vpc_security_group_ids, var.defaults.vpc_security_group_ids, null)
3535
tags = try(each.value.tags, var.defaults.tags, {})
36+
function_tags = try(each.value.function_tags, var.defaults.function_tags, {})
3637
s3_object_tags = try(each.value.s3_object_tags, var.defaults.s3_object_tags, {})
3738
s3_object_tags_only = try(each.value.s3_object_tags_only, var.defaults.s3_object_tags_only, false)
3839
package_type = try(each.value.package_type, var.defaults.package_type, "Zip")

0 commit comments

Comments
 (0)