Closed honungsburk closed 14 hours ago
Hi @honungsburk!
Checking the google_cloud_run_v2_job
Google cloud service we test the functionality with this terraform registry template and the result was successful without errors.
I suggest you to check your project configuration, environment variables and your docker_container image
as it is a provider we have no control over.
You can guide yourself with this other example, wich was used in this ticket:
provider "google" {
user_project_override = true
billing_project = "my-project"
project = "my-project"
}
terraform {
required_providers {
google = {
source = "hashicorp/google-beta"
version = "5.36.0"
}
}
}
resource "google_cloud_run_v2_job" "cr_v2_job_18625" {
provider = google-beta
name = "cr-v2-job-18625"
location = "us-central1"
launch_stage = "BETA"
template {
template {
containers {
image = "us-docker.pkg.dev/cloudrun/container/job"
}
}
}
}
@honungsburk I think your expected behavior is incorrect and this isn't a bug, but a misconfigured terraform and thus you should expect a failure.
As the Cloud Run Job documentation mentions, a Cloud Run Job must pull images from either an Artifact Registry or Docker Hub. The image
argument reference documentation also reiterates this requirement.
image - (Required) URL of the Container image in Google Container Registry or Google Artifact Registry. More info: https://kubernetes.io/docs/concepts/containers/images
To correct your configuration, you should follow the steps for deploying local sources to cloud run in your terraform:
You will most likely have to use the depends_on
terraform meta argument to ensure those resources are created in the proper order.
Yes, eventually I was able to figure out that you have to upload the images to some repository available through the internet. Would it be possible to guide the user by returning a more informative error message?
@honungsburk , I don't think it is possible to guide the user by returning a more informative error message.
@honungsburk you just need to follow the provided guides and read the documentation. Doing that is a good practice before starting to use any software.
Community Note
Terraform Version & Provider Version(s)
Terraform v1.9.0 on Macbook Pro M1
Affected Resource(s)
Terraform Configuration
Debug Output
No response
Expected Behavior
I expect it to use the image without issue
Actual Behavior
I get this error:
Steps to reproduce
terraform apply
Important Factoids
I'm trying to pull a local docker image. Maybe the docker provider finds it but the google provider try to pull it from docker hub?
References
No response