Default values are also added part of user input in ansible resource modules, is this bug or by design?

Hi All,

Default values are also added part of user input in ansible resource modules, is this bug or by design?

Below is the configuration available in switch:

  • name: Ethernet28

access:

vlan: 11

trunk:

  • vlan: 12

  • vlan: 13

Delete all allowed VLANs NOT access VLAN:

  • name: “Delete all allowed VLANs NOT access VLAN”

sonic_l2_interfaces:

config:

  • name: Ethernet28

trunk:

state: deleted

Inside the module,

but expected want variable data inside the module coming as below:

  • name: Ethernet28

trunk: null

but actual want variable data inside the module coming as below: because both the values are coming as null, in module there is no way to differentiate whats the user input that needs to be deleted?

  • name: Ethernet28

access: null

trunk: null

is this a bug or as per design?

These default values are added at https://github.com/ansible/ansible/blob/stable-2.9/lib/ansible/module_utils/basic.py#L1837

if this is by design, how to delete only access or trunk VLANs?

Thanks

Mohamed Javeed