diff --git a/modules/cloud-run-v2/README.md b/modules/cloud-run-v2/README.md
index a08978c5b..e9fb7b61a 100644
--- a/modules/cloud-run-v2/README.md
+++ b/modules/cloud-run-v2/README.md
@@ -499,7 +499,7 @@ module "cloud_run" {
| [service_account](variables.tf#L221) | Service account email. Unused if service account is auto-created. | string | | null |
| [service_account_create](variables.tf#L227) | Auto-create service account. | bool | | false |
| [tag_bindings](variables.tf#L233) | Tag bindings for this service, in key => tag value id format. | map(string) | | {} |
-| [volumes](variables.tf#L240) | Named volumes in containers in name => attributes format. | map(object({…})) | | {} |
+| [volumes](variables.tf#L240) | Named volumes in containers in name => attributes format. | map(object({…})) | | {} |
| [vpc_connector_create](variables-vpcconnector.tf#L17) | Populate this to create a Serverless VPC Access connector. | object({…}) | | null |
## Outputs
diff --git a/modules/cloud-run-v2/job.tf b/modules/cloud-run-v2/job.tf
index e42ae495a..3b27df0f6 100644
--- a/modules/cloud-run-v2/job.tf
+++ b/modules/cloud-run-v2/job.tf
@@ -127,6 +127,21 @@ resource "google_cloud_run_v2_job" "job" {
size_limit = volumes.value.empty_dir_size
}
}
+ dynamic "gcs" {
+ for_each = volumes.value.gcs == null ? [] : [""]
+ content {
+ bucket = volumes.value.bucket
+ read_only = volumes.value.is_read_only
+ }
+ }
+ dynamic "nfs" {
+ for_each = volumes.value.nfs == null ? [] : [""]
+ content {
+ server = volumes.value.server
+ path = volumes.value.path
+ read_only = volumes.value.is_read_only
+ }
+ }
}
}
}
diff --git a/modules/cloud-run-v2/service.tf b/modules/cloud-run-v2/service.tf
index 347068c65..fd69c71d1 100644
--- a/modules/cloud-run-v2/service.tf
+++ b/modules/cloud-run-v2/service.tf
@@ -205,6 +205,21 @@ resource "google_cloud_run_v2_service" "service" {
size_limit = volumes.value.empty_dir_size
}
}
+ dynamic "gcs" {
+ for_each = volumes.value.gcs == null ? [] : [""]
+ content {
+ bucket = volumes.value.bucket
+ read_only = volumes.value.is_read_only
+ }
+ }
+ dynamic "nfs" {
+ for_each = volumes.value.nfs == null ? [] : [""]
+ content {
+ server = volumes.value.server
+ path = volumes.value.path
+ read_only = volumes.value.is_read_only
+ }
+ }
}
}
}
diff --git a/modules/cloud-run-v2/variables.tf b/modules/cloud-run-v2/variables.tf
index 459411b78..472b2f8e0 100644
--- a/modules/cloud-run-v2/variables.tf
+++ b/modules/cloud-run-v2/variables.tf
@@ -249,7 +249,24 @@ variable "volumes" {
}))
cloud_sql_instances = optional(list(string))
empty_dir_size = optional(string)
+ gcs = optional(object({
+ # needs revision.gen2_execution_environment
+ bucket = string
+ is_read_only = optional(bool)
+ }))
+ nfs = optional(object({
+ server = string
+ path = optional(string)
+ is_read_only = optional(bool)
+ }))
}))
default = {}
nullable = false
+ validation {
+ condition = alltrue([
+ for k, v in var.volumes :
+ sum([for kk, vv in v : vv == null ? 0 : 1]) == 1
+ ])
+ error_message = "Only one type of volume can be defined at a time."
+ }
}
diff --git a/modules/net-vpc/outputs.tf b/modules/net-vpc/outputs.tf
index 4d143e829..8184e96d4 100644
--- a/modules/net-vpc/outputs.tf
+++ b/modules/net-vpc/outputs.tf
@@ -28,7 +28,7 @@ output "id" {
output "internal_ipv6_range" {
description = "ULA range."
- value = try(local.network.internal_ipv6_range, null)
+ value = try(google_compute_network.network[0].internal_ipv6_range, null)
}
output "name" {