From 85ffc8615cb30b0a2525713b7f97e9543ca28b02 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 12 Jan 2024 14:45:56 -0600 Subject: [PATCH 1/3] aws_datasync_task: allow removal of schedule --- internal/service/datasync/task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/datasync/task.go b/internal/service/datasync/task.go index 3ac39fad143..54742ada705 100644 --- a/internal/service/datasync/task.go +++ b/internal/service/datasync/task.go @@ -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{}) From 8d27b8bf99e9b3d25f3ab34f697bc847fdd57ab6 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 12 Jan 2024 17:06:03 -0600 Subject: [PATCH 2/3] aws_datasync_task: test for schedule removal --- internal/service/datasync/task_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/service/datasync/task_test.go b/internal/service/datasync/task_test.go index db7d236f3ab..4d640570347 100644 --- a/internal/service/datasync/task_test.go +++ b/internal/service/datasync/task_test.go @@ -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"), + ), + }, }, }) } From 378942d6f602d4976304fcb23542d510196e08ec Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 12 Jan 2024 17:08:04 -0600 Subject: [PATCH 3/3] add CHANGELOG entry --- .changelog/35282.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/35282.txt diff --git a/.changelog/35282.txt b/.changelog/35282.txt new file mode 100644 index 00000000000..119dabac783 --- /dev/null +++ b/.changelog/35282.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_datasync_task: Allow `schedule` to be removed successfully +```