Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
- Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
- If an issue is assigned to the
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.
Terraform Version
$ terraform -v
Terraform v0.12.20
+ provider.google v3.5.0
Affected Resource(s)
google_cloud_run_service
google_endpoints_service
Terraform Configuration Files
resource "google_cloud_run_service" "run" {
name = var.name
location = var.location
template {
spec {
containers {
image = "gcr.io/endpoints-release/endpoints-runtime-serverless:2"
env {
name = "ENDPOINTS_SERVICE_NAME"
value = google_endpoints_service.openapi_service.service_name
}
}
}
}
}
resource "google_endpoints_service" "openapi_service" {
service_name = replace(google_cloud_run_service.run.status[0].url, "https://", "")
project = var.project_id
openapi_config = var.config
}
Debug Output
Panic Output
Expected Behavior
Please note that I do not expect this deployment with circular dependency to work.
But there must be a working scenario for creating Endpoints for Google Function possibly followed different approach or with different API.
Current API seem not to permit such cases.
Actual Behavior
The circular dependency error appears
Steps to Reproduce
terraform apply
Important Factoids
Google Cloud endpoint documentation from here - https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions reads the following steps to create Endpoint for Google Function
- Create ESP service with Google Run and remember the URL address allocated by Google for this service
- Crete Endpoint service (Use that URL address obtained on previous step to build the endpoint openapi config)
- Update the ESP service created on step 1 with the name of the Endpoint
But these steps make both resources dependent on each other and inevitably bring to circular dependency error in Terraform.
There must be a working scenario for creating Endpoints for Google Function.
References
- Google documentation for Endpoint for Google Function https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions
- b/272363819