diff --git a/README.md b/README.md index c3514c78..7ff45dff 100644 --- a/README.md +++ b/README.md @@ -789,6 +789,7 @@ No modules. | [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 | | [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 | | [function\_name](#input\_function\_name) | A unique name for your Lambda Function | `string` | `""` | no | +| [function\_tags](#input\_function\_tags) | A map of tags to assign only to the lambda function | `map(string)` | `{}` | no | | [handler](#input\_handler) | Lambda Function entrypoint in your code | `string` | `""` | no | | [hash\_extra](#input\_hash\_extra) | The string to add into hashing function. Useful when building same source path for different functions. | `string` | `""` | no | | [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 | diff --git a/examples/complete/main.tf b/examples/complete/main.tf index ec7b56d1..ef487199 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -172,6 +172,10 @@ module "lambda_function" { delete = "20m" } + function_tags = { + Language = "python" + } + tags = { Module = "lambda1" } diff --git a/main.tf b/main.tf index 78ec8df3..f8433369 100644 --- a/main.tf +++ b/main.tf @@ -118,7 +118,7 @@ resource "aws_lambda_function" "this" { delete = try(var.timeouts.delete, null) } - tags = var.tags + tags = merge(var.tags, var.function_tags) depends_on = [ null_resource.archive, diff --git a/variables.tf b/variables.tf index a3215394..b085b895 100644 --- a/variables.tf +++ b/variables.tf @@ -182,6 +182,12 @@ variable "tags" { default = {} } +variable "function_tags" { + description = "A map of tags to assign only to the lambda function" + type = map(string) + default = {} +} + variable "s3_object_tags" { description = "A map of tags to assign to S3 bucket object." type = map(string) diff --git a/wrappers/main.tf b/wrappers/main.tf index f4a520bf..4a101cd2 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -33,6 +33,7 @@ module "wrapper" { vpc_subnet_ids = try(each.value.vpc_subnet_ids, var.defaults.vpc_subnet_ids, null) vpc_security_group_ids = try(each.value.vpc_security_group_ids, var.defaults.vpc_security_group_ids, null) tags = try(each.value.tags, var.defaults.tags, {}) + function_tags = try(each.value.function_tags, var.defaults.function_tags, {}) s3_object_tags = try(each.value.s3_object_tags, var.defaults.s3_object_tags, {}) s3_object_tags_only = try(each.value.s3_object_tags_only, var.defaults.s3_object_tags_only, false) package_type = try(each.value.package_type, var.defaults.package_type, "Zip")