terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

add NFS and GCS volume support to Cloud Run v2 *Jobs*

Open moredip opened this issue 1 year ago • 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 an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Description

Support for NFS and GCS volumes in Cloud Run services was recently added, but is still not available for Cloud Run jobs.

New or Affected Resource(s)

  • google_cloud_run_v2_job

Potential Terraform Configuration

resource "google_cloud_run_v2_job" "default" {
  name     = "service"
  launch_stage = "BETA"

  template {
    template {

      volumes {
        name = "nfs"
        nfs {
          server = google_filestore_instance.default.networks[0].ip_addresses[0]
          path   = "/share1"
        }
      }
  
      volumes {
        name = "bucket"
        gcs {
          bucket = google_storage_bucket.default.name
        }
      }

      containers {
        image = "us-docker.pkg.dev/cloudrun/container/hello:latest"
        volume_mounts {
          name       = "nfs"
          mount_path = "/mnt/nfs"
        }
        volume_mounts {
          name       = "gcs"
          mount_path = "/mnt/bucket"
        }
      }
   }
}

References

related issues (covering cloud run services):

  • https://github.com/hashicorp/terraform-provider-google/issues/17059
  • https://github.com/hashicorp/terraform-provider-google/issues/16880

PR implementing GCS and NFS support in service:

  • https://github.com/GoogleCloudPlatform/magic-modules/pull/9728

b/326474722

moredip avatar Feb 21 '24 16:02 moredip

This appears to be something that can be added to jobs the same way as it was for services, however, I cannot find the nfs or gcs fields documented in the public API documentation https://cloud.google.com/run/docs/reference/rest/v2/Volume. With that said, I'm forwarding to the service team as a viable coverage gap, but it's possible this can only be done with services at this point in time.

roaks3 avatar Feb 22 '24 18:02 roaks3

It can be done with jobs, I guess the documentation just hasn't been updated yet. You can see it in the golang api Documentation, for example, which I guess gets updated more often. https://pkg.go.dev/google.golang.org/api/run/v2#GoogleCloudRunV2GCSVolumeSource

I included GCS in jobs in https://github.com/GoogleCloudPlatform/magic-modules/pull/9746 but then someone beat me to including it in Services and I haven't merged those changes in yet.

bskaplan avatar Feb 22 '24 22:02 bskaplan

It can be done with jobs, I guess the documentation just hasn't been updated yet. You can see it in the golang api Documentation, for example, which I guess gets updated more often. https://pkg.go.dev/google.golang.org/api/run/v2#GoogleCloudRunV2GCSVolumeSource

I included GCS in jobs in GoogleCloudPlatform/magic-modules#9746 but then someone beat me to including it in Services and I haven't merged those changes in yet.

@bskaplan is this something you're planning to take on?

moredip avatar Feb 27 '24 15:02 moredip

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Apr 30 '24 02:04 github-actions[bot]