diff --git a/plugins/modules/gcp_compute_subnetwork.py b/plugins/modules/gcp_compute_subnetwork.py index 35a22fc..c890637 100644 --- a/plugins/modules/gcp_compute_subnetwork.py +++ b/plugins/modules/gcp_compute_subnetwork.py @@ -386,12 +386,12 @@ def update(module, link, kind, fetch): def update_fields(module, request, response): if response.get('ipCidrRange') != request.get('ipCidrRange'): ip_cidr_range_update(module, request, response) - if response.get('secondaryIpRanges') != request.get('secondaryIpRanges'): + if response.get('secondaryIpRanges') != request.get('secondaryIpRanges') or response.get('privateIpv6GoogleAccess') != request.get( + 'privateIpv6GoogleAccess' + ): secondary_ip_ranges_update(module, request, response) if response.get('privateIpGoogleAccess') != request.get('privateIpGoogleAccess'): private_ip_google_access_update(module, request, response) - if response.get('privateIpv6GoogleAccess') != request.get('privateIpv6GoogleAccess'): - private_ipv6_google_access_update(module, request, response) def ip_cidr_range_update(module, request, response): @@ -408,7 +408,10 @@ def secondary_ip_ranges_update(module, request, response): auth = GcpSession(module, 'compute') auth.patch( ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}"]).format(**module.params), - {u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request()}, + { + u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(), + u'privateIpv6GoogleAccess': module.params.get('private_ipv6_google_access'), + }, ) @@ -422,14 +425,6 @@ def private_ip_google_access_update(module, request, response): ) -def private_ipv6_google_access_update(module, request, response): - auth = GcpSession(module, 'compute') - auth.patch( - ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}"]).format(**module.params), - {u'privateIpv6GoogleAccess': module.params.get('private_ipv6_google_access')}, - ) - - def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link))