Argument seems to be required even though it is not

Hello! I’m currently developing a custom module to support a specific network OS. This module takes some custom arguments. The problem is that even though some of them are not required, when running a playbook Ansible still sees it as an error and fails the task.

What did I do wrong here? It seems to be the case only for arguments with the option “choices”, as if they were automatically seen as required, altough this is not the functionning I’m looking for.

Thanks for your help!

My playbook :

    - name: Configure interfaces
      custom.ers.ers_interfaces:
        config:
          - interfaces: 10-14
            vlan: 100,200,300
            pvid: 100

My argument specs:

self._argument_spec = {
            "config": {
                "elements": "dict",
                "options": {
                    "interfaces": {"type": "str", "required": True},
                    "vlan": {"type": "str"},
                    "pvid": {"type": "str"},
                    "tagging": {"type": "str", "choices": ["untagall", "untagpvidonly", "tagall"]},
                    "shutdown": {"type": "str", "choices": ["enabled", "disabled"]},
                    "description": {"type": "str"}
                },
                "type": "list",
            }
        }

@nikuiz Hello!

What error message did you get?

Sorry, I completely forgot to include the error message :grimacing:

Here it is :

"msg": "value of tagging must be one of: untagall, untagpvidonly, tagall, got: None found in config"

or

"msg": "value of shutdown must be one of: enabled, disabled, got: None found in config"