Skip to content

Commit

Permalink
Merge pull request hashicorp#35282 from hashicorp/b-datasync_task_sch…
Browse files Browse the repository at this point in the history
…edule

r/aws_datasync_task: allow removal of schedule
  • Loading branch information
johnsonaj authored Jan 16, 2024
2 parents bfcb1f0 + 378942d commit bd1dd5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/35282.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_datasync_task: Allow `schedule` to be removed successfully
```
2 changes: 1 addition & 1 deletion internal/service/datasync/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ func expandOptions(l []interface{}) *datasync.Options {

func expandTaskSchedule(l []interface{}) *datasync.TaskSchedule {
if len(l) == 0 || l[0] == nil {
return nil
return &datasync.TaskSchedule{ScheduleExpression: aws.String("")} // explicitly set empty object if schedule is nil
}

m := l[0].(map[string]interface{})
Expand Down
7 changes: 7 additions & 0 deletions internal/service/datasync/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ func TestAccDataSyncTask_schedule(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "schedule.0.schedule_expression", "cron(0 12 ? * SUN,MON *)"),
),
},
{
Config: testAccTaskConfig_basic(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckTaskExists(ctx, resourceName, &task1),
resource.TestCheckResourceAttr(resourceName, "schedule.#", "0"),
),
},
},
})
}
Expand Down

0 comments on commit bd1dd5c

Please sign in to comment.