Repository: ansible-collections/community.general

Issue:
Set session_prefix rule via consul_acl
##### SUMMARY
I can manually set in Consul:
```
session_prefix "" {
  policy = "write"
}
```

But via consul_acl I get errors.

##### ISSUE TYPE
- Feature Idea

##### COMPONENT NAME
consul_acl

##### ADDITIONAL INFORMATION
<!--- Describe how the feature would be used, why it is needed and what it would solve -->

<!--- Paste example playbooks or commands between quotes below -->
```yaml
  - name: Create an acl with specific token with both key and service rules
    consul_acl:
      mgmt_token: "{{ consul_mgmt_token }}"
      name: Token for traefik
      token: "{{ consul_traefik_token }}"
      rules:
        - key: traefik
          policy: write
        - session: ""
          policy: write
        - session_prefix: ""
          policy: write
```

Error:
```
TASK [traefik : Create an acl with specific token with both key and service rules] *************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: A rule requires one of agent/event/key/keyring/node/operator/query/service/session and a policy.
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 102, in <module>\n  File \"<stdin>\", line 94, in _ansiballz_main\n  File \"<stdin>\", line 40, in invoke_module\n  File \"/usr/lib/python3.8/runpy.py\", line 206, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_consul_acl_payload_r7_luy0y/ansible_consul_acl_payload.zip/ansible/modules/clustering/consul_acl.py\", line 663, in <module>\n  File \"/tmp/ansible_consul_acl_payload_r7_luy0y/ansible_consul_acl_payload.zip/ansible/modules/clustering/consul_acl.py\", line 639, in main\n  File \"/tmp/ansible_consul_acl_payload_r7_luy0y/ansible_consul_acl_payload.zip/ansible/modules/clustering/consul_acl.py\", line 426, in decode_rules_as_yml\nValueError: A rule requires one of agent/event/key/keyring/node/operator/query/service/session and a policy.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
```


Discussion:
Files identified in the description:
* [`plugins/modules/clustering/consul/consul_acl.py`](https://github.com/ansible-collections/community.general/blob/master/plugins/modules/clustering/consul/consul_acl.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @colin-nolan @sgargan
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
The same issue with node_prefix and service_prefix
+label waiting_on_contributor
resolved_by_pr #2495 

@4n70w4 can you please test whether that change fixes the issue for you?
Thanks for the improvement. At the moment I am not working on a project where this was used. If the opportunity arises, I will definitely check.

Resolving patch:
diff --git a/plugins/modules/clustering/consul/consul_acl.py b/plugins/modules/clustering/consul/consul_acl.py
--- a/plugins/modules/clustering/consul/consul_acl.py
+++ b/plugins/modules/clustering/consul/consul_acl.py
@@ -189,7 +189,24 @@
 from ansible.module_utils.basic import to_text, AnsibleModule
 
 
-RULE_SCOPES = ["agent", "event", "key", "keyring", "node", "operator", "query", "service", "session"]
+RULE_SCOPES = [
+    "agent",
+    "agent_prefix",
+    "event",
+    "event_prefix",
+    "key",
+    "key_prefix",
+    "keyring",
+    "node",
+    "node_prefix",
+    "operator",
+    "query",
+    "query_prefix",
+    "service",
+    "service_prefix",
+    "session",
+    "session_prefix",
+]
 
 MANAGEMENT_PARAMETER_NAME = "mgmt_token"
 HOST_PARAMETER_NAME = "host"


Test patch: