I’m deploying a container via Google Cloud Run and would like to pass the public URI to an environment variable for the resource. How can I do this without running multiple passes of terraform apply
or depending upon outside executables (if I’m using some sort of Terraform automation)?
resource "google_cloud_run_v2_service" "cr_myapp" {
name = "myapp"
location = "us-central1"
ingress = "INGRESS_TRAFFIC_ALL"
template {
service_account = module.service_account.email
containers {
image = "myapp:${var.myapp_version}"
# added variable
env {
name = "PUBLIC_URL"
value = google_cloud_run_v2_service.cr_myapp.uri # <-- this is wrong because it creates a circular dependency
}
}
}
}