Repository: ansible/ansible

Issue:
Lambda: unsupported parameter for module: environment_variable
<!---
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release, and master branch are affected too.
-->

##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
 - Documentation Bug Report

##### COMPONENT NAME
<!--- 
```
Lambda module 
```
-->

##### ANSIBLE VERSION
<!--- Paste verbatim output from “ansible --version” between quotes below -->
```
ansible 2.2.1.0

```

##### CONFIGURATION
<!---
Mention any settings you have changed/added/removed in ansible.cfg
(or using the ANSIBLE_* environment variables).
-->

##### OS / ENVIRONMENT
```
macOS Sierra 10.12.2
boto
boto3
python >= 2.6
```

##### SUMMARY
```
When running task to create lambda function, if I add the environment_variables parameter the task fails with msg:
unsupported parameter for module: environment_variables
When I comment the line out it runs fine.
```

##### STEPS TO REPRODUCE
<!---
For bugs, show exactly how to reproduce the problem, using a minimal test-case.
For new features, show how the feature would be used.
-->

<!--- Paste example playbooks or commands between quotes below -->
```yaml
file lambda-create-function.yml

- name: Create lambda function
  hosts: localhost
  gather_facts: false
  tasks:
  - name: Create lambda function
    lambda:
      name: "{{ lambda_name }}"
      description: "{{ lambda_description }}"
      state: 'present'
      timeout: "{{ lambda_timeout }}"
      zip_file: "{{ lambda_zip_file }}"
      runtime: "{{ lambda_runtime }}"
      memory_size: "{{ lambda_memory_size }}"
      handler: "{{ lambda_handler }}"
      role: "{{ lambda_iam_role_arn }}"
      vpc_subnet_ids: "{{ lambda_vpc_subnet_ids }}"
      vpc_security_group_ids: "{{ lambda_vpc_security_group_ids }}"
      environment_variables: "{{ lambda_environment_variables }}"

ansible-playbook lambda-create-function.yml
```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
```
Play should run without errors as it does without the  environment_variables parameter
```

##### ACTUAL RESULTS
```
TASK [Create lambda function] **************************************************
task path: /Users/kmcnally/git/devops-infrastructure/ansible/tasks/lambda-create-function.yml:21
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: environment_variables"}
```





Discussion:
It looks like the environment_variables parameter was added in 2.3 (we're about to enter feature freeze for 2.3).  I'll change this to a documentation bug to make sure that's noted in the module docs.

Resolving patch:
diff --git a/lib/ansible/modules/cloud/amazon/lambda.py b/lib/ansible/modules/cloud/amazon/lambda.py
--- a/lib/ansible/modules/cloud/amazon/lambda.py
+++ b/lib/ansible/modules/cloud/amazon/lambda.py
@@ -102,6 +102,7 @@
     required: false
     default: None
     aliases: [ 'environment' ]
+    version_added: "2.3"
 author:
     - 'Steyn Huizinga (@steynovich)'
 extends_documentation_fragment:


Test patch: