gcp_compute_* modules: trying to link using selfLink

I am new to using Ansible and the gcp_* modules.

This is in relation to making use of Google Cloud Platform and Ansible.

Let us say that I have two projects: HOST_PROJECT and SERVICE_PROJECT. They are both part of the same organisation.
The host project, serves as a shared VPC host, while the service project is using the shared VPC from the host project.

Using Ansible, I want to create an instance template (using the gcp_compute_instance_template module) to create a template the makes use of the shared VPC network.

Here is my ansible playbook:

`

`

Hello.
Try to use ‘- network: " {{ network }}"’ instead of ‘- network: “{{ network.selfLink }}”’

What fixed this for me was the following:
Instead of using “{{ network.selfLink }}”, I used “{{ network.resources[0] }}”.

Not the most elegant solution, but it worked

Thank you for the response,

But unfortunately, this also did not work for me

Hi Lujaina,

Were you able to get this working I’m currently working on a project trying to get this working exactly in the same setup as your post.