Skip to content

Commit

Permalink
r/aws_appflow_flow: Don't send empty 'task' during update -- hashicor…
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Nov 17, 2023
1 parent e766888 commit ae3ed0a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .changelog/34456.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
```release-note:bug
resource/aws_appflow_flow: Fix `interface conversion: interface {} is nil, not map[string]interface {}` panic
```

```release-note:bug
resource/aws_appflow_flow: Fix `InvalidParameter: 2 validation error(s) found` error when `task` is updated
```
3 changes: 3 additions & 0 deletions internal/service/appflow/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,9 @@ func expandTask(tfMap map[string]interface{}) *types.Task {

if v, ok := tfMap["task_type"].(string); ok && v != "" {
a.TaskType = types.TaskType(v)
} else {
// https://github.com/hashicorp/terraform-provider-aws/issues/28237.
return nil
}

return a
Expand Down
6 changes: 3 additions & 3 deletions internal/service/appflow/flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func TestAccAppFlowFlow_taskUpdate(t *testing.T) {
),
},
{
Config: testAccFlowConfig_multipleTasks(rSourceName, rDestinationName, rFlowName, "anotherField"),
Config: testAccFlowConfig_multipleTasks(rSourceName, rDestinationName, rFlowName, "anotherTestField"),
Check: resource.ComposeTestCheckFunc(
testAccCheckFlowExists(ctx, resourceName, &flowOutput),
resource.TestCheckResourceAttr(resourceName, "task.#", "3"),
Expand All @@ -252,9 +252,9 @@ func TestAccAppFlowFlow_taskUpdate(t *testing.T) {
"task_type": "Map",
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "task.*", map[string]string{
"destination_field": "anotherField",
"destination_field": "anotherTestField",
"source_fields.#": "1",
"source_fields.0": "anotherField",
"source_fields.0": "anotherTestField",
"task_properties.%": "2",
"task_properties.DESTINATION_DATA_TYPE": "id",
"task_properties.SOURCE_DATA_TYPE": "id",
Expand Down

0 comments on commit ae3ed0a

Please sign in to comment.