ansible –version
ansible 2.10.8

When creating a vm and the nic:

TASK [Create virtual network inteface card] ****************************************************************************************************
[DEPRECATION WARNING]: Setting ip_configuration flatten is deprecated and will be removed. Using ip_configurations list to define the ip        
configuration. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in       
ansible.cfg.                        
changed: [localhost] 

  - name: Create virtual network interface card
    azure_rm_networkinterface:
      resource_group: ResourceGroup1
      name: nic12
      virtual_network: vnet12
      subnet: subnet
      public_ip_name: public-ip12
      security_group: network-security-group12

How can we fix this?

Have a look at the docs for ip_configuration.

azure.azcollection.azure_rm_networkinterface module – Manage Azure network interfaces — Ansible Documentation

There are examples at the end.

Our code that caused the warning.

 - name: Create virtual network interface card
    azure_rm_networkinterface:
      resource_group: ResourceGroup1
      name: nic12
      virtual_network: vnet12
      subnet: subnet
      public_ip_name: public-ip12
      security_group: network-security-group12

After looking at the docs, we also gave the ip_configuration a name config1, instead of default.

  - name: Create virtual network interface card
    azure_rm_networkinterface:
      resource_group: ResourceGroup2
      name: nic12
      virtual_network: vnet12
      subnet: subnet
      security_group: network-security-group12
      ip_configurations:
        - name: ipconfig1
          public_ip_address_name: public-ip12
          primary: True

ansible-playbook createvm/main.yml