Repository: ansible/ansible
Pull request: fix documentation to match default/required status of 'state'
##### SUMMARY
simple docfix. Fixes #31639.

##### ISSUE TYPE
 - Docs Pull Request

##### COMPONENT NAME
cloud/amazon/cloudformation

##### ANSIBLE VERSION
devel head

Problem statement:
[cloudformation] 'state' is not a required option
The `cloudformation` doc specifies that the `state` option is **required**. But that is not the case in the argument spec in code -

> state=dict(default='present', choices=['present', 'absent'])

So either the doc needs to be fixed or we need to enforce the presence of the `state` option.

##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
`cloudformation`

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes below -->
```
ansible 2.5.0 last updated 2017/10/11 22:07:08 (GMT -700)
```

##### CONFIGURATION

N/A

##### OS / ENVIRONMENT

N/A

##### SUMMARY
The `cloudformation` doc specifies that the `state` option is **required**. But that is not the case in the argument spec in code -

> state=dict(default='present', choices=['present', 'absent'])

So either the doc needs to be fixed or we need to enforce the presence of the `state` option.


##### STEPS TO REPRODUCE

<!--- Paste example playbooks or commands between quotes below -->
```yaml
-  cloudformation:
    stack_name: "ansible-cloudformation"
    template: "files/cloudformation-example.json"
```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
The task should have failed since `state` is absent. 

##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->
The stack gets created as the default value for `state` is `present`

Hints from issue discussion:
cc @jsmartin @ryansb @tedder
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Yeah, default + required is kinda silly. I'll remove required.

Commit message: fix documentation to match default/required status of 'state'

Patch to review:
diff --git a/lib/ansible/modules/cloud/amazon/cloudformation.py b/lib/ansible/modules/cloud/amazon/cloudformation.py
index b6f65413ab1ffe..33c99cd129efeb 100644
--- a/lib/ansible/modules/cloud/amazon/cloudformation.py
+++ b/lib/ansible/modules/cloud/amazon/cloudformation.py
@@ -47,7 +47,8 @@
     description:
       - If state is "present", stack will be created.  If state is "present" and if stack exists and template has changed, it will be updated.
         If state is "absent", stack will be removed.
-    required: true
+    default: present
+    required: false
   template:
     description:
       - The local path of the cloudformation template.


Code review comments:
diff_hunk: @@ -47,7 +47,8 @@
     description:
       - If state is "present", stack will be created.  If state is "present" and if stack exists and template has changed, it will be updated.
         If state is "absent", stack will be removed.
-    required: true
+    default: present
+    required: false
path: lib/ansible/modules/cloud/amazon/cloudformation.py
text: @user1:
Can you also add `choices` please?

@author:
done.