Fixes #39648 azure_rm_virtualnetwork not handling DNS settings properly on existing virtual networks (#40646)

* check nullable

* add test

* fix

* fix

(cherry picked from commit 7b9864776a)
pull/41306/head
Yuwei Zhou 7 years ago committed by Matt Clay
parent 3ed8300dff
commit ca992f5aba

@ -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')

@ -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

Loading…
Cancel
Save