title: Is it possible to deploy a background Function "myBgFunctionInProjectB" in "project-b" and triggered by my topic "my-topic-project-a" from "project-a"
body: <p>It's possible to create a topic <em>"my-topic-project-a"</em> in project <em>"project-a"</em> so that it can be publicly visible (this is done by setting the role <em>"pub/sub subscriber"</em> to <em>"allUsers"</em> on it).
  Then from project <em>"project-b"</em> I can create a subscription to <em>"my-topic-project-a"</em>  and read the events from <em>"my-topic-project-a"</em>. This is done using the following gcloud commands:
  (these commands are executed on project "project-b")</p>
  
  <pre><code>gcloud pubsub subscriptions create subscription-to-my-topic-project-a --topic projects/project-a/topics/my-topic-project-a
  gcloud pubsub subscriptions pull subscription-to-my-topic-project-a --auto-ack
  </code></pre>
  
  <p>So ok this is possible when creating a subscription in "project-b" linked to "my-topic-project-a" in "project-a".</p>
  
  <p><strong>In my use case I would like to be able to deploy a background function "myBgFunctionInProjectB" in "project-b" and triggered by my topic "my-topic-project-a" from "project-a"</strong></p>
  
  <p>But ... this doesn't seem to be possible since gcloud CLI is not happy when you provide the full topic name while deploying the cloud function:</p>
  
  <pre><code>gcloud beta functions deploy myBgFunctionInProjectB --runtime nodejs8 --trigger-topic projects/project-a/topics/my-topic-project-a --trigger-event google.pubsub.topic.publish
  
  ERROR: (gcloud.beta.functions.deploy) argument --trigger-topic: Invalid value 'projects/project-a/topics/my-topic-project-a': Topic must contain only Latin letters (lower- or upper-case), digits and the characters - + . _ ~ %. It must start with a letter and be from 3 to 255 characters long.
  </code></pre>
  
  <p>is there a way to achieve that or this is actually not possible?</p>
  
  <p>Thanks</p>