# gcp\_compute\_\* modules: trying to link using selfLink

**URL:** <https://forum.ansible.com/t/gcp-compute-modules-trying-to-link-using-selflink/31891>\
**Category:** Ansible Project\
**Created:** [January 2, 2020, 1:15pm UTC](https://forum.ansible.com/t/gcp-compute-modules-trying-to-link-using-selflink/31891 "2020-01-02T13:15:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lujaina\_Abu\_Erban](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@Lujaina\_Abu\_Erban](https://forum.ansible.com/u/Lujaina_Abu_Erban)\
**Post date:** [January 2, 2020, 1:15pm UTC](https://forum.ansible.com/t/gcp-compute-modules-trying-to-link-using-selflink/31891/1 "2020-01-02T13:15:52Z")

</div>

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:

`

`

---

<div class="post-metadata">

**Author:** ![JF1](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@JF1](https://forum.ansible.com/u/JF1)\
**Post date:** [January 2, 2020, 1:41pm UTC](https://forum.ansible.com/t/gcp-compute-modules-trying-to-link-using-selflink/31891/2 "2020-01-02T13:41:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lujaina\_Abu\_Erban](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@Lujaina\_Abu\_Erban](https://forum.ansible.com/u/Lujaina_Abu_Erban)\
**Post date:** [January 2, 2020, 2:45pm UTC](https://forum.ansible.com/t/gcp-compute-modules-trying-to-link-using-selflink/31891/3 "2020-01-02T14:45:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lujaina\_Abu\_Erban](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@Lujaina\_Abu\_Erban](https://forum.ansible.com/u/Lujaina_Abu_Erban)\
**Post date:** [January 2, 2020, 2:46pm UTC](https://forum.ansible.com/t/gcp-compute-modules-trying-to-link-using-selflink/31891/4 "2020-01-02T14:46:16Z")

</div>

Thank you for the response,

But unfortunately, this also did not work for me

---

<div class="post-metadata">

**Author:** ![Frank\_Gravato](https://avatars.discourse-cdn.com/v4/letter/f/48db29/32.png) [@Frank\_Gravato](https://forum.ansible.com/u/Frank_Gravato)\
**Post date:** [March 12, 2020, 3:30pm UTC](https://forum.ansible.com/t/gcp-compute-modules-trying-to-link-using-selflink/31891/5 "2020-03-12T15:30:27Z")

</div>

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.
