cloudposse / terraform-aws-lambda-function

A module for launching Lambda Fuctions
https://cloudposse.com/accelerate
Apache License 2.0
30 stars 40 forks source link

Cloudwatch submodule naming forces the var `function_name` to `lower`. #73

Closed nnsense closed 3 weeks ago

nnsense commented 3 weeks ago

Describe the Bug

I'm using this module to create a lambda, and I set the name attribute myself in CamelCase. The module creates all correctly except the Cloudwatch log group, which is instead all lowercase. This of course doesn't match with the function_name setting, the function is unable to find its CW group, and the CW group (all lowercase) is basically there doing nothing.

This is likely due to the Cloudwatch submodule that, I couldn't figure out where TBH, is setting the name attribute to lower. The context is actually mentioning that setting defaults to lower but then the real default is null. If I use that module alone and I manually set label_value_case to none there, then I can get my names in upper/camel/pascal case.

My opinion is that is due to the vars being set to module.this.vars instead of the whole context being set to module.this.context. If I change that (into the tf cache, just for testing), my context is passed and name and all other attributes are consistent.

If you think this makes sense, I will create a PR to change that, it's literally a few characters to change :)

Thanks

Expected Behavior

If the function_name variable is set to anything but lowercase, the Cloudwatch log group name should be consistent, it is instead forced to be all lowercase, that makes the function unable to use it.

Steps to Reproduce

Just set function_name to ThisIsMyLambda, the module will create the Cloudwatch log group as thisismylambda.

Screenshots

No response

Environment

No response

Additional Context

No response