Repository: ansible-collections/amazon.aws

Issue:
lambda_info does not preserve environment variable names
### Summary

`lambda_info` returns environment variables for functions with the following changes:

* All lowercase
* Any camelCase names converted to snake_case

This is likely due to passing all API data about the functions through `camel_dict_to_snake_dict`.

### Issue Type

Bug Report

### Component Name

lambda_info

### Ansible Version

```console (paste below)
$ ansible --version
ansible [core 2.14.1]
  config file = /home/josh/devel/ansible-repo/ansible/ansible.cfg
  configured module search path = ['/home/josh/devel/ansible-repo/ansible/plugins/modules']
  ansible python module location = /home/josh/devel/ansible-repo/ansible/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/josh/.ansible/ansible-repo-collections:/home/josh/devel/ansible-repo/ansible/collections
  executable location = /home/josh/devel/ansible-repo/ansible/venv/bin/ansible
  python version = 3.10.9 (main, Dec 12 2022, 10:21:01) [GCC 9.4.0] (/home/josh/devel/ansible-repo/ansible/venv/bin/python)
  jinja version = 3.1.2
  libyaml = True
```


### Collection Versions

```console (paste below)
$ ansible-galaxy collection list
# /home/josh/.ansible/ansible-repo-collections/ansible_collections
Collection        Version
----------------- -------
amazon.aws        5.0.0  
community.aws     5.0.0  
community.general 6.1.0  
```


### AWS SDK versions

```console (paste below)
$ pip show boto boto3 botocore
Name: boto
Version: 2.49.0
Summary: Amazon Web Services Library
Home-page: https://github.com/boto/boto/
Author: Mitch Garnaat
Author-email: mitch@garnaat.com
License: MIT
Location: /home/josh/devel/ansible-repo/ansible/venv/lib/python3.10/site-packages
Requires: 
Required-by: 
---
Name: boto3
Version: 1.26.27
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /home/josh/devel/ansible-repo/ansible/venv/lib/python3.10/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: 
---
Name: botocore
Version: 1.29.27
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /home/josh/devel/ansible-repo/ansible/venv/lib/python3.10/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: boto3, s3transfer
```


### Configuration

```console (paste below)
$ ansible-config dump --only-changed

```


### OS / Environment

_No response_

### Steps to Reproduce

Run against an AWS account that has a Lambda function with environment variables with uppercase and camelCase var names.

```yaml (paste below)
- name: Get Lambda Info
  amazon.aws.lambda_info:
    function_name: my-example-func
    query: config
  register: _lambda_info

- debug: var=_lambda_info
```


### Expected Results

I expected to see environment variable names preserved under `_lambda_info.functions.0.environment.variables`



### Actual Results

Instead, env var names are all in lowercase, and any camelCase names are converted to snake_case (ie: fooBar -> foo_bar).

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
@joshbenner Thank you for raising this issue. Would you be willing to open a Pull Request with a patch for this issue?
cc @jillr @pjodouin @s-hertel @tremble
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/plugins/modules/lambda_info.py b/plugins/modules/lambda_info.py
--- a/plugins/modules/lambda_info.py
+++ b/plugins/modules/lambda_info.py
@@ -385,7 +385,14 @@ def config_details(client, module, function_name):
     except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:  # pylint: disable=duplicate-except
         module.fail_json_aws(e, msg="Trying to get {0} configuration".format(function_name))
 
-    return camel_dict_to_snake_dict(lambda_info)
+    if "Environment" in lambda_info and "Variables" in lambda_info["Environment"]:
+        env_vars = lambda_info["Environment"]["Variables"]
+        snaked_lambda_info = camel_dict_to_snake_dict(lambda_info)
+        snaked_lambda_info["environment"]["variables"] = env_vars
+    else:
+        snaked_lambda_info = camel_dict_to_snake_dict(lambda_info)
+
+    return snaked_lambda_info
 
 
 def mapping_details(client, module, function_name):


Test patch: