mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-06 10:50:28 -07:00
fix bug to handle duplicate subnet across different vpc networks
This commit is contained in:
parent
db81dcd5d5
commit
3505b5ac47
1 changed files with 5 additions and 1 deletions
|
@ -317,6 +317,7 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import (
|
|||
)
|
||||
import json
|
||||
import time
|
||||
import ipaddress
|
||||
|
||||
################################################################################
|
||||
# Main
|
||||
|
@ -353,7 +354,10 @@ def main():
|
|||
|
||||
if fetch:
|
||||
if state == 'present':
|
||||
if is_different(module, fetch):
|
||||
if module.params['network']['selfLink'] != fetch['network']: # found difference on same subnet within the same VPC network
|
||||
module.fail_json(msg="Subnet already exists in a different VPC network: %s, please change the name or region" % fetch['network'])
|
||||
changed = False
|
||||
elif is_different(module, fetch):
|
||||
update(module, self_link(module), kind, fetch)
|
||||
fetch = fetch_resource(module, self_link(module), kind)
|
||||
changed = True
|
||||
|
|
Loading…
Add table
Reference in a new issue