Skip to content

Commit

Permalink
Allows empty value and sets default value for maxRetries of cloud run…
Browse files Browse the repository at this point in the history
… job (#7425) (#14223)

* send empty value

* add client side default

* remove defaul_from_api

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Apr 5, 2023
1 parent 7689179 commit 2839d0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changelog/7425.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:breaking-change
cloudrunv2: set a default value of 3 for `max_retries` in `google_cloud_run_v2_job`. This should match the API's existing default, but may show a diff at plan time
```
```release-note:bug
cloudrunv2: fixed the bug where setting `max_retries` to 0 in `google_cloud_run_v2_job` was not respected.
```
4 changes: 2 additions & 2 deletions google/resource_cloud_run_v2_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ This field is not supported in Cloud Run Job currently.`,
},
"max_retries": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Number of retries allowed per Task, before marking this Task failed.`,
Default: 3,
},
"service_account": {
Type: schema.TypeString,
Expand Down Expand Up @@ -2278,7 +2278,7 @@ func expandCloudRunV2JobTemplateTemplate(v interface{}, d TerraformResourceData,
transformedMaxRetries, err := expandCloudRunV2JobTemplateTemplateMaxRetries(original["max_retries"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMaxRetries); val.IsValid() && !isEmptyValue(val) {
} else {
transformed["maxRetries"] = transformedMaxRetries
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_cloud_run_v2_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ resource "google_cloud_run_v2_job" "default" {
connector = google_vpc_access_connector.connector.id
egress = "ALL_TRAFFIC"
}
max_retries = 2
max_retries = 0
}
}
Expand Down

0 comments on commit 2839d0e

Please sign in to comment.