diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py index b461cdd83e8..b3d1832a797 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py @@ -257,7 +257,7 @@ class AzureRMVirtualNetwork(AzureRMModuleBase): changed = True if self.dns_servers: - existing_dns_set = set(vnet.dhcp_options.dns_servers) + existing_dns_set = set(vnet.dhcp_options.dns_servers) if vnet.dhcp_options else set([]) requested_dns_set = set(self.dns_servers) if existing_dns_set != requested_dns_set: self.log('CHANGED: replacing DNS servers') diff --git a/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml b/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml index a978aff4f70..7554be5149d 100644 --- a/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml +++ b/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml @@ -4,6 +4,17 @@ resource_group: "{{ resource_group }}" state: absent +- name: Create virtual network + azure_rm_virtualnetwork: + name: my_test_network + address_prefixes_cidr: + - 10.1.0.0/16 + - 172.100.0.0/16 + tags: + testing: testing + delete: on-exit + resource_group: "{{ resource_group }}" + - name: Create virtual network azure_rm_virtualnetwork: name: my_test_network