title: Terraform GCP Cloud function using Github
body: <p>I want to create a Google Cloud Function using Terraform but want to pull the source code from Github.</p>
  
  <p>I managed to do this zipping up the function and copying it into Cloud Storage using Terraform, but I do not like this workflow as I have to run a script to kick things off. I rather just do a PR on Github and see the new code in GCP.</p>
  
  <p>I already setup Google Cloud Source Repositories to source from my Github.</p>
  
  <p>The Terraform doc to use the "<strong>source_repository</strong>" argument is not clear to me. What I would like to do is just grab the source from <strong>HEAD</strong> on the <strong>master</strong> branch.</p>
  
  <p>This function source code is located under the sub-folder:</p>
  
  <p>“<strong>cloud-functions/training_data</strong>”</p>
  
  <p>There are two files inside the function folder:</p>
  
  <ul>
  <li>“main.py”</li>
  <li>“requirements.txt”</li>
  </ul>
  
  <p>I just would like to know how to specify the “source_repository” argument in this case.</p>