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

* check nullable

* add test

* fix

* fix
This commit is contained in:
Yuwei Zhou 2018-05-28 15:45:01 +08:00 committed by Zim Kalinowski
parent dde48560fb
commit 7b9864776a
2 changed files with 12 additions and 1 deletions

View file

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

View file

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