hashicorp/terraform-provider-google

Add google_cloud_run_locations data source

ahmetb opened this issue ยท 2 comments

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 the 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 the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

Please create a new Data Source called google_cloud_run_locations to retrieve available locations for Cloud Run.

This would be similar to google_compute_zones data source, and can use the Cloud Run REST API v1 (https://cloud.google.com/run/docs/reference/rest/v1/projects.locations/list) to retrieve available locations.

Without this data source, I have to do this:

variable "regions" {
    type = list(string)
    description = "deploy to regions"

    /*

    Cloud Run Regions list can be obtained from the REST API:

        curl -sSLfH "Authorization: Bearer $(gcloud auth print-access-token -q)" \
            "https://run.googleapis.com/v1/projects/$(gcloud config get-value core/project -q)/locations?alt=json" |\
            jq '[.locations[].locationId]'
    */
    default = [
      "asia-east1",
      "asia-east2",
      "asia-northeast1",
      "asia-northeast2",
      "asia-northeast3",
  ...

which is no fun.

New or Affected Resource(s)

  • NEW: google_cloud_run_locations

Potential Terraform Configuration

data "google_cloud_run_locations" "available" {
}

It would have a field called names or regions to carry the available location IDs.

cc: @steren

References

Internal context for Googlers: we are trying to develop a Terraform equivalent of serving traffic from multiple regions guide, having this would be necessary to publish such a sample.

I'm going to lock this issue because it has been closed for 30 days โณ. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error ๐Ÿค– ๐Ÿ™‰ , please reach out to my human friends ๐Ÿ‘‰ hashibot-feedback@hashicorp.com. Thanks!