title: Using 'gcloud services vpc-peerings connect' in Deployment Manager
body: <p>I'm setting up a deployment manager package in .jinja which does the following:
  - Creates VPC Network, Subnet and Private Range for GCP Services
  - Creates the peering between 'servicenetworking.googleapis.com' and my VPC network
  - Assigns the Cloud SQL database into the private range assigned to google services within my VPC</p>
  
  <p>The second step is proving impossible with deployment manager as there is no action that can be called to do this. I have confirmed the fix manually at this stage is to call the following gcloud command and then set up the Cloud SQL database in the VPC:</p>
  
  <pre><code>gcloud services vpc-peerings connect --service=servicenetworking.googleapis.com --ranges=&lt;my-range&gt; --network=&lt;my-network&gt; --project=&lt;my-project&gt;
  </code></pre>
  
  <p>Using the following gcp-type in my .jinja isn't sufficient as it doesn't allow mapping to pre-existing gcp services but expects a source and destination network.</p>
  
  <pre><code>- name: {{ env['deployment' ]}}-gcp-private-vpc-peering
    action: gcp-types/compute-v1:compute.networks.addPeering
    metadata:
      runtimePolicy:
      - CREATE
    properties:
      network: $(ref.{{ env['deployment']}}-network.name)
      name: {{ env['deployment' ]}}-gcp-private-vpc-peering
      autoCreateRoutes: true
      peerNetwork: servicenetworking.googleapis.com
      dependsOn:
      - $(ref.{{ env['deployment']}}-network.selfLink)
  </code></pre>
  
  <p>Is there a way to call the gcloud command from the deployment manager, or an action I can call upon to achieve the service peering. I can confirm the Service API is indeed enabled on the project.</p>
  
  <p>(Note that the destination VPC and project are variable, assigned by Google therefore I cannot enter this value into the above template)</p>
  
  <hr>
  
  <p>Update 05/07/19
  I believe I have found the API service call I need to do, but I'm very unsure of the syntax to actually make the call to create the service link from deployment manager:</p>
  
  <p><a href="https://cloud.google.com/service-infrastructure/docs/service-networking/reference/rest/v1beta/services.connections/create" rel="nofollow noreferrer">https://cloud.google.com/service-infrastructure/docs/service-networking/reference/rest/v1beta/services.connections/create</a></p>
  
  <p>Need a bit of direction - similar to below?</p>
  
  <pre><code>- name: {{ env['deployment' ]}}-gcp-private-vpc-peering
    action:  gcp-types/servicenetworking.googleapis.com:services.connections
    metadata:
      runtimePolicy:
      - CREATE
    properties:
      propertyA: valueA
      ...
  </code></pre>