Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

cloud build docker_repository configuration throws error about format but format is right

When I deploy a cloud function v2 using terraform trying to specify a docker_repository, I get this error

Error: Error creating function: googleapi: Error 400: Repository name `projects/org-service-accounts-401323/locations/us/repositories/gcr.io` has an invalid format. It should match the pattern `projects/{project}/locations/{location}/repositories/{repository}`.

But the format looks correct....

Using terraform 1.9.5 and google provider 5.42.0

Here are the configs I tried

build_config {
runtime = "nodejs18"
entry_point = "onRequest" # Set the entry point
# docker_repository = "us-east1-docker.pkg.dev/my-project/my-repo/my-image"
docker_repository = "projects/${var.common_project_id}/locations/us/repositories/${var.registry_name}"
# docker_repository = "${var.common_project_id}/us/${var.registry_name}"
 
source {
storage_source {
bucket = google_storage_bucket.default.name
object = google_storage_bucket_object.default.name
}
}
0 1 209
1 REPLY 1