Open tomerslice opened 1 year ago
Note: Cloud Run may not be returning the service URL through its API in time, if that gets populated asynchronously.
I'm not sure this is quite in a workable state yet, so holding off on forwarding.
@tomerslice Could you please provide your Terraform config and the output you are receiving?
If this is not in workable state yet, I will wait with my question for a future time. I just wanted to pass it's url as env variable to another service.
I have this same issue.
I have to work around this by using a data
reference like this:
resource "google_cloud_run_v2_service" "my-app" {
name = "my-app"
location = "us-central1"
project = local.project
...
}
# Build a data source to get the URL of the Cloud Run service.
# This seems like a bug on the cloud run v2 provider to not provide the URL of the service
data "google_cloud_run_service" "my-app" {
location = "us-central1"
project = local.project
name = google_cloud_run_v2_service.my-app.name
}
output "app-url" {
value = data.google_cloud_run_service.my-app.status[0].url
}
Would be nice if the v2 resource exposed a status URL!
It seems to me that the URIs you're looking for are output-only fields in the schema, but they may not be reconciled, as @rileykarson mentioned. See more info under the reconciling
field description.
It looks like @TaylorMutch has a workaround, which may be working because it introduces a short delay. Ideally, it might be nice to have a way to instruct Terraform to wait for reconciliation.
After returning to this the next day I can do
output "app-url" {
value = google_cloud_run_v2_service.my-app.uri
}
Which works, but its not desirable to have to wait for the output to succeed a terraform run. On initial deployment the output variable won't have the uri
field populated so it just looks like an empty string, which isn't expected.
Community Note
Description
Hey, on google_cloud_run_v2 I can't access its url. It's an internal http service that needs to answer other services http requests. I need to give them a url to give the requests to.
New or Affected Resource(s)
References
b/298050680