From 9a7bc214fbc7b380ea35d3b417cfa6a58aa3e23c Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 28 May 2024 14:08:32 -0700 Subject: [PATCH] fix: Verify `google_cloud_run_v2_{service,job}` 'timeout' field with regex (#10611) (#18260) [upstream:be365d7a2466aebe55fafcb2fa317ff60eb87b45] Signed-off-by: Modular Magician --- google/services/cloudrunv2/resource_cloud_run_v2_job.go | 7 ++++--- .../services/cloudrunv2/resource_cloud_run_v2_service.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/google/services/cloudrunv2/resource_cloud_run_v2_job.go b/google/services/cloudrunv2/resource_cloud_run_v2_job.go index 6dcee1f36d3..c8bb773541a 100644 --- a/google/services/cloudrunv2/resource_cloud_run_v2_job.go +++ b/google/services/cloudrunv2/resource_cloud_run_v2_job.go @@ -256,9 +256,10 @@ If omitted, a port number will be chosen and passed to the container through the Description: `Email address of the IAM service account associated with the Task of a Job. The service account represents the identity of the running task, and determines what permissions the task has. If not provided, the task will use the project's default service account.`, }, "timeout": { - Type: schema.TypeString, - Computed: true, - Optional: true, + Type: schema.TypeString, + Computed: true, + Optional: true, + ValidateFunc: verify.ValidateRegexp(`^[0-9]+(?:\.[0-9]{1,9})?s$`), Description: `Max allowed time duration the Task may be active before the system will actively try to mark it failed and kill associated containers. This applies per attempt of a task, meaning each retry can run for the full timeout. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".`, diff --git a/google/services/cloudrunv2/resource_cloud_run_v2_service.go b/google/services/cloudrunv2/resource_cloud_run_v2_service.go index 7bd858ae461..cc95a7b5268 100644 --- a/google/services/cloudrunv2/resource_cloud_run_v2_service.go +++ b/google/services/cloudrunv2/resource_cloud_run_v2_service.go @@ -559,9 +559,10 @@ All system labels in v1 now have a corresponding field in v2 RevisionTemplate.`, Description: `Enables session affinity. For more information, go to https://cloud.google.com/run/docs/configuring/session-affinity`, }, "timeout": { - Type: schema.TypeString, - Computed: true, - Optional: true, + Type: schema.TypeString, + Computed: true, + Optional: true, + ValidateFunc: verify.ValidateRegexp(`^[0-9]+(?:\.[0-9]{1,9})?s$`), Description: `Max allowed time for an instance to respond to a request. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".`,