Hello all!
I’m running Terraform v1.1.4 and I’m running into an issue that has been raised previously, but always required a manual workaround.
Take the following simple cloudbuild trigger:
resource "google_cloudbuild_trigger" "build-trigger" {
filename = "${var.cloudbuild_file}"
description = local.trigger_description
project = "${var.project}"
name = "${var.repo}-master"
github {
owner = "${var.github_org}"
name = "${var.repo}"
push {
branch = "^master$"
}
}
}
When running a Terraform Apply, I get the following:
google_cloudbuild_trigger.build-trigger: Creating...
╷
│ Error: Error creating Trigger: googleapi: Error 400: Repository mapping does not exist. Please visit https://console.cloud.google.com/cloud-build/triggers/connect?project=<blah> to connect a repository to your project
The terraform plan does reveal that the repository is named correctly, but the issue is that you have to open the Cloud Build UI and “connect the repository” between GitHub and Cloud Build before the Terraform call can succeed.
While this works for deploying existing applications to different places, this somewhat defeats the purpose for being able to seamlessly deploy new/arbitrary github apps, and we have to tell developers to log into cloud build and link the repo first.
Has anyone found a way around this?
Thanks!