delete subnet should be idempotent (#35037)

pull/35327/head
Yuwei Zhou 7 years ago committed by Jordan Borean
parent e9e85625aa
commit 7c201fc9bc

@ -254,7 +254,7 @@ class AzureRMSubnet(AzureRMModuleBase):
resource_guid=nsg.resource_guid)
self.results['state'] = self.create_or_update_subnet(subnet)
elif self.state == 'absent':
elif self.state == 'absent' and changed:
# delete subnet
self.delete_subnet()
# the delete does not actually return anything. if no exception, then we'll assume

@ -82,6 +82,17 @@
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
- name: Remove subnet (idempotent)
azure_rm_subnet:
state: absent
name: foobar
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
register: output
- assert:
that: not output.changed
- name: Remove security group
azure_rm_securitygroup:
resource_group: "{{ resource_group }}"

Loading…
Cancel
Save