Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows empty value and sets default value for maxRetries of cloud run job #14223

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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