Open tiagojsag opened 2 years ago
Hi @tiagojsag, We are limited to what is possible from the API. Taking a look at the API reference, I cannot find a field that exposes the webhook URL, and am not sure how it would be done otherwise. Do you see how this could be done from the API?
The webhook URL format is made from project id, cloud api key and secret. Currently the issues are:
google_apikeys_key
but the issue is that the key_string (needed to build the URL) is : An encrypted and signed value held by this key. This field can be accessed only through the GetKeyString method
which is only available (that I could find) in the gcloud alpha services api-keys get-key-string
so getting the secret is ugly (data.external script) right now.The missing data.google_apikeys_key
makes it indeed tough. Does anyone have a workaround, ugly as it may be?
Im having the same issue here. I'm trying to streamline my Terraform workflow by automating the retrieval and use of webhook URLs within my modules. Could anyone outline any way to achieve this? Thanks!
Community Note
Description
I am implementing a Cloud Build trigger closely based on the example in the docs. My ultimate goal is to use TF with the Google + Github providers, and trigger a Cloud Build run when commits are pushed to key Github branches.
AFAICT there is no way to fully reconstruct the webhook URL I would need to pass to Github. Using TF I can create the Cloud Build trigger, and then go to the GCP console and get the url, but programmatically I cannot access the API Key that is needed to fully recreate it (more info here )
(In case anyone points it out, I know that there is a "dedicated" Github configuration for
google_cloudbuild_trigger
. I explored it up to the point where it requires grating a bunch of permissions to a Google/Github integration, for what seems to be simply creating a webhook on GH's side. Due to privacy concerns, that will be my plan Z, and I'll explore other options first.)New or Affected Resource(s)
Potential Terraform Configuration
Ideally, webhook-based
google_cloudbuild_trigger
resources would have an additional attribute for the final webhook URL, that could be easily accessed programmatically.b/270750578