Skip to content

Commit 17b2adb

Browse files
fix: allow DOM and Month fields
1 parent 7853727 commit 17b2adb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

provider/workspace_preset.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ func workspacePresetDataSource() *schema.Resource {
210210
}
211211
}
212212

213-
// validatePrebuildsCronSpec ensures that the minute, day-of-month and month options of spec are all set to *
213+
// validatePrebuildsCronSpec ensures that the minute field is set to *
214214
func validatePrebuildsCronSpec(spec string) error {
215215
parts := strings.Fields(spec)
216216
if len(parts) != 5 {
217217
return fmt.Errorf("cron specification should consist of 5 fields")
218218
}
219-
if parts[0] != "*" || parts[2] != "*" || parts[3] != "*" {
220-
return fmt.Errorf("minute, day-of-month and month should be *")
219+
if parts[0] != "*" {
220+
return fmt.Errorf("minute field should be *")
221221
}
222222

223223
return nil

provider/workspace_preset_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ func TestWorkspacePreset(t *testing.T) {
442442
}
443443
}
444444
}`,
445-
ExpectError: regexp.MustCompile(`cron spec failed validation: minute, day-of-month and month should be *`),
445+
ExpectError: regexp.MustCompile(`cron spec failed validation: minute field should be *`),
446446
},
447447
{
448448
Name: "Prebuilds is set with an autoscaling.schedule field, but the cron hour field is invalid",

0 commit comments

Comments
 (0)