diff --git a/modules/cloud-run-v2/README.md b/modules/cloud-run-v2/README.md
index c4e0156cf..13172c353 100644
--- a/modules/cloud-run-v2/README.md
+++ b/modules/cloud-run-v2/README.md
@@ -984,15 +984,15 @@ module "worker" {
| [labels](variables.tf#L130) | Resource labels. | map(string) | | {} |
| [launch_stage](variables.tf#L136) | The launch stage as defined by Google Cloud Platform Launch Stages. | string | | null |
| [managed_revision](variables.tf#L153) | Whether the Terraform module should control the deployment of revisions. | bool | | true |
-| [revision](variables.tf#L175) | Revision template configurations. | object({…}) | | {} |
-| [service_account](variables.tf#L235) | Service account email. Unused if service account is auto-created. | string | | null |
-| [service_account_create](variables.tf#L241) | Auto-create service account. | bool | | false |
-| [service_config](variables.tf#L247) | Cloud Run service specific configuration options. | object({…}) | | {} |
-| [tag_bindings](variables.tf#L310) | Tag bindings for this service, in key => tag value id format. | map(string) | | {} |
-| [type](variables.tf#L317) | Type of Cloud Run resource to deploy: JOB, SERVICE or WORKERPOOL. | string | | "SERVICE" |
-| [volumes](variables.tf#L327) | Named volumes in containers in name => attributes format. | map(object({…})) | | {} |
+| [revision](variables.tf#L175) | Revision template configurations. | object({…}) | | {} |
+| [service_account](variables.tf#L236) | Service account email. Unused if service account is auto-created. | string | | null |
+| [service_account_create](variables.tf#L242) | Auto-create service account. | bool | | false |
+| [service_config](variables.tf#L248) | Cloud Run service specific configuration options. | object({…}) | | {} |
+| [tag_bindings](variables.tf#L311) | Tag bindings for this service, in key => tag value id format. | map(string) | | {} |
+| [type](variables.tf#L318) | Type of Cloud Run resource to deploy: JOB, SERVICE or WORKERPOOL. | string | | "SERVICE" |
+| [volumes](variables.tf#L328) | 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 |
-| [workerpool_config](variables.tf#L361) | Cloud Run Worker Pool specific configuration. | object({…}) | | {} |
+| [workerpool_config](variables.tf#L362) | Cloud Run Worker Pool specific configuration. | object({…}) | | {} |
## Outputs
diff --git a/modules/cloud-run-v2/variables.tf b/modules/cloud-run-v2/variables.tf
index 615d833e9..4472e94d3 100644
--- a/modules/cloud-run-v2/variables.tf
+++ b/modules/cloud-run-v2/variables.tf
@@ -189,34 +189,35 @@ variable "revision" {
tags = optional(list(string))
}), {})
timeout = optional(string)
+ # deprecated fields
+ gen2_execution_environment = optional(any) # DEPRECATED
+ job = optional(any) # DEPRECATED
+ max_concurrency = optional(any) # DEPRECATED
+ max_instance_count = optional(any) # DEPRECATED
+ min_instance_count = optional(any) # DEPRECATED
})
default = {}
nullable = false
validation {
- condition = !contains(keys(var.revision), "gen2_execution_environment")
- error_message = "Field gen2_execution_environment moved to var.service_config."
+ condition = lookup(var.revision, "gen2_execution_environment", null) == null
+ error_message = "Field gen2_execution_environment has moved to var.service_config."
}
validation {
- condition = !contains(keys(var.revision), "max_concurrency")
- error_message = "Field max_concurrency moved to var.service_config."
+ condition = lookup(var.revision, "job", null) == null
+ error_message = "Field job has moved to var.job_config."
}
validation {
- condition = !contains(keys(var.revision), "max_concurrency")
- error_message = "Field max_concurrency moved to var.service_config."
+ condition = lookup(var.revision, "max_concurrency", null) == null
+ error_message = "Field max_concurrency has moved to var.service_config."
}
validation {
- condition = !contains(keys(var.revision), "max_instance_count")
- error_message = "Field max_instance_count moved to var.service_config."
+ condition = lookup(var.revision, "max_instance_count", null) == null
+ error_message = "Field max_instance_count has moved to var.service_config."
}
validation {
- condition = !contains(keys(var.revision), "min_instance_count")
- error_message = "Field min_instance_count moved to var.service_config."
+ condition = lookup(var.revision, "min_instance_count", null) == null
+ error_message = "Field min_instance_count has moved to var.service_config."
}
- validation {
- condition = !contains(keys(var.revision), "job")
- error_message = "Field job moved to var.job_config."
- }
-
validation {
condition = (
try(var.revision.vpc_access.egress, null) == null ? true : contains(