Commit 18b8620
fix: Add null/label context tags to the aws_lambda_function resource (#44)
Problem:
Prior to this, the `aws_lambda_function` resource was not getting tagged at all
when passing just the null/label context into the module.
For example, this would end up with a completely untagged Lambda function even
though I am passing the context from a standard null/label declaration:
```
module "test" {
source = "cloudposse/lambda-function/aws"
version = "0.5.1"
function_name = "${module.this.id}-test"
attributes = ["foo"]
description = var.lambda_description
s3_bucket = var.lambda_s3_bucket
s3_key = var.lambda_s3_key
runtime = var.lambda_runtime
handler = var.lambda_handler
context = module.this.context
}
```
To get any tags on the lambda, the `tags` attribute must be used:
```
module "test" {
source = "cloudposse/lambda-function/aws"
version = "0.5.1"
function_name = "${module.this.id}-test"
attributes = ["foo"]
description = var.lambda_description
s3_bucket = var.lambda_s3_bucket
s3_key = var.lambda_s3_key
runtime = var.lambda_runtime
handler = var.lambda_handler
context = module.this.context
tags = module.this.tags
}
```
The requirement of passing an explicit `tags` attribute is not how other
CloudPosse modules work. In most other CloudPosse modules, you can just pass
around a null/label context and the tags will automatically show up in child
resources.
Solution:
Use `tags = module.this.tags` on the `aws_lambda_function` resource.
Outcome:
* The `aws_lambda_function` resource is tagged with the implicit tags passed in via `context`.
* Tags from the `tags` variable are still present, but are now merged with the tags from `context`.
* This module follows the convetion of other CloudPosse modules.
* People used to CloudPosse modules will have an easier time using this module.
Co-authored-by: Dan Miller <[email protected]>1 parent 517135d commit 18b8620
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments