From e5a3c71ad6af36f329b39469a3c8d3348b61cfc9 Mon Sep 17 00:00:00 2001 From: John Raines Date: Wed, 10 Aug 2022 17:24:34 -0500 Subject: [PATCH 1/6] appflow_flow assigns flattenedScheduled to scheduled instead of trigger_properties --- internal/service/appflow/flow.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index 267ed1b9eb4..fc0f46b436e 100644 --- a/internal/service/appflow/flow.go +++ b/internal/service/appflow/flow.go @@ -3537,7 +3537,7 @@ func flattenTriggerProperties(triggerProperties *appflow.TriggerProperties) map[ m := map[string]interface{}{} if v := triggerProperties.Scheduled; v != nil { - m["trigger_properties"] = []interface{}{flattenScheduled(v)} + m["scheduled"] = []interface{}{flattenScheduled(v)} } return m From 821922b99b44316ef6128f7b3391bb24dfc6816f Mon Sep 17 00:00:00 2001 From: John Raines Date: Wed, 10 Aug 2022 22:41:44 -0500 Subject: [PATCH 2/6] Added changelog placeholder, pending PR creation. --- .changelog/placeholder.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/placeholder.txt diff --git a/.changelog/placeholder.txt b/.changelog/placeholder.txt new file mode 100644 index 00000000000..71460c4b5a3 --- /dev/null +++ b/.changelog/placeholder.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_appflow_flow: Fix trigger_properties.schedule being set to trigger_properties.trigger_properties. +``` \ No newline at end of file From 57251f89a0fe3c0eae3b431457b3c6f6c1273800 Mon Sep 17 00:00:00 2001 From: John Raines Date: Wed, 10 Aug 2022 22:57:09 -0500 Subject: [PATCH 3/6] Added a check for the trigger_properties.0.scheduled in the AppFlow Flow test --- internal/service/appflow/flow_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/service/appflow/flow_test.go b/internal/service/appflow/flow_test.go index c5646af1f5b..8b05d013889 100644 --- a/internal/service/appflow/flow_test.go +++ b/internal/service/appflow/flow_test.go @@ -46,6 +46,7 @@ func TestAccAppFlowFlow_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "task.0.task_type"), resource.TestCheckResourceAttrSet(resourceName, "trigger_config.#"), resource.TestCheckResourceAttrSet(resourceName, "trigger_config.0.trigger_type"), + resource.TestCheckResourceAttrSet(resourceName, "trigger_config.0.trigger_type.0.scheduled"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), ), From 917cb71c755263547ec7e90b8797fb6262bbe505 Mon Sep 17 00:00:00 2001 From: John Raines Date: Wed, 10 Aug 2022 23:02:36 -0500 Subject: [PATCH 4/6] Updated changelog entry name --- .changelog/{placeholder.txt => 26240.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changelog/{placeholder.txt => 26240.txt} (100%) diff --git a/.changelog/placeholder.txt b/.changelog/26240.txt similarity index 100% rename from .changelog/placeholder.txt rename to .changelog/26240.txt From 8d52e4f894b1d1c5d5b64cd5bdd7ccede146ff4b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 11 Aug 2022 09:29:54 -0400 Subject: [PATCH 5/6] Update 26240.txt --- .changelog/26240.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changelog/26240.txt b/.changelog/26240.txt index 71460c4b5a3..2e6f2f6f784 100644 --- a/.changelog/26240.txt +++ b/.changelog/26240.txt @@ -1,3 +1,3 @@ ```release-note:bug -resource/aws_appflow_flow: Fix trigger_properties.schedule being set to trigger_properties.trigger_properties. -``` \ No newline at end of file +resource/aws_appflow_flow: Fix `trigger_properties.schedule` being set to `trigger_properties.trigger_properties` during resource read +``` From dbf3ea060da67940c783606034c2498899725356 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 11 Aug 2022 09:52:47 -0400 Subject: [PATCH 6/6] r/aws_appflow_flow: Set 'trigger_config.trigger_properties.scheduled' in 'TestAccAppFlowFlow_basic'. --- internal/service/appflow/flow_test.go | 32 ++++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/internal/service/appflow/flow_test.go b/internal/service/appflow/flow_test.go index 8b05d013889..e5381d40892 100644 --- a/internal/service/appflow/flow_test.go +++ b/internal/service/appflow/flow_test.go @@ -31,7 +31,7 @@ func TestAccAppFlowFlow_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccFlowConfig_basic(rSourceName, rDestinationName, rFlowName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckFlowExists(resourceName, &flowOutput), acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "appflow", regexp.MustCompile(`flow/.+`)), resource.TestCheckResourceAttr(resourceName, "name", rFlowName), @@ -44,9 +44,12 @@ func TestAccAppFlowFlow_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "task.#"), resource.TestCheckResourceAttrSet(resourceName, "task.0.source_fields.#"), resource.TestCheckResourceAttrSet(resourceName, "task.0.task_type"), - resource.TestCheckResourceAttrSet(resourceName, "trigger_config.#"), - resource.TestCheckResourceAttrSet(resourceName, "trigger_config.0.trigger_type"), - resource.TestCheckResourceAttrSet(resourceName, "trigger_config.0.trigger_type.0.scheduled"), + resource.TestCheckResourceAttr(resourceName, "trigger_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_type", "Scheduled"), + resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_properties.#", "1"), + resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_properties.0.scheduled.#", "1"), + resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_properties.0.scheduled.0.data_pull_mode", "Complete"), + resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_properties.0.scheduled.0.schedule_expression", "rate(5minutes)"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), ), @@ -189,7 +192,7 @@ func TestAccAppFlowFlow_disappears(t *testing.T) { }) } -func testAccConfigFlowBase(rSourceName string, rDestinationName string) string { +func testAccFlowConfig_base(rSourceName string, rDestinationName string) string { return fmt.Sprintf(` data "aws_partition" "current" {} @@ -268,7 +271,7 @@ EOF func testAccFlowConfig_basic(rSourceName string, rDestinationName string, rFlowName string) string { return acctest.ConfigCompose( - testAccConfigFlowBase(rSourceName, rDestinationName), + testAccFlowConfig_base(rSourceName, rDestinationName), fmt.Sprintf(` resource "aws_appflow_flow" "test" { name = %[3]q @@ -309,7 +312,14 @@ resource "aws_appflow_flow" "test" { } trigger_config { - trigger_type = "OnDemand" + trigger_type = "Scheduled" + + trigger_properties { + scheduled { + data_pull_mode = "Complete" + schedule_expression = "rate(5minutes)" + } + } } } `, rSourceName, rDestinationName, rFlowName), @@ -318,7 +328,7 @@ resource "aws_appflow_flow" "test" { func testAccFlowConfig_update(rSourceName string, rDestinationName string, rFlowName string, description string) string { return acctest.ConfigCompose( - testAccConfigFlowBase(rSourceName, rDestinationName), + testAccFlowConfig_base(rSourceName, rDestinationName), fmt.Sprintf(` resource "aws_appflow_flow" "test" { name = %[3]q @@ -369,7 +379,7 @@ resource "aws_appflow_flow" "test" { func testAccFlowConfig_taskProperties(rSourceName string, rDestinationName string, rFlowName string) string { return acctest.ConfigCompose( - testAccConfigFlowBase(rSourceName, rDestinationName), + testAccFlowConfig_base(rSourceName, rDestinationName), fmt.Sprintf(` resource "aws_appflow_flow" "test" { name = %[3]q @@ -424,7 +434,7 @@ resource "aws_appflow_flow" "test" { func testAccFlowConfig_tags1(rSourceName string, rDestinationName string, rFlowName string, tagKey1 string, tagValue1 string) string { return acctest.ConfigCompose( - testAccConfigFlowBase(rSourceName, rDestinationName), + testAccFlowConfig_base(rSourceName, rDestinationName), fmt.Sprintf(` resource "aws_appflow_flow" "test" { name = %[3]q @@ -478,7 +488,7 @@ resource "aws_appflow_flow" "test" { func testAccFlowConfig_tags2(rSourceName string, rDestinationName string, rFlowName string, tagKey1 string, tagValue1 string, tagKey2 string, tagValue2 string) string { return acctest.ConfigCompose( - testAccConfigFlowBase(rSourceName, rDestinationName), + testAccFlowConfig_base(rSourceName, rDestinationName), fmt.Sprintf(` resource "aws_appflow_flow" "test" { name = %[3]q