Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Pass selfLink to netwrok and subnetwork rather then get network information #22

Conversation

WissemChb
Copy link
Contributor

Summary

This PR is the continuation of a discussion started in this #20. We tested the code as requested and We found a possible fix.

Problem

We get this error when using the driver because we haven't read/list access to shared VPC.

fatal: [localhost]: FAILED! => {"changed": false, "msg": "GCP returned error: {'error': {'code': 403, 'message': \"Required 'compute.networks.list' permission for 'projects/vg1np-core-apps7-90'\", 'errors': [{'message': \"Required 'compute.networks.list' permission for 'projects/vg1np-core-apps7-90'\", 'domain': 'global', 'reason': 'forbidden'}]}}"}

Solution

After a lot of search in the google.cloud.gcp_compute_instance, we found that the network object use selfLink attribute to attach the instance to the network. So, We think it is better to pass the network configuration to the instance using the selfLink rather than get network information that needs permissions to do.

@WissemChb WissemChb marked this pull request as ready for review August 31, 2021 19:14
@nbttmbrg nbttmbrg added the bug Something isn't working label Sep 1, 2021
Copy link
Collaborator

@nbttmbrg nbttmbrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaner code, tested and works as expected

@nbttmbrg nbttmbrg merged commit 1d3d363 into ansible-community:main Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants