Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_appflow_flow: fix perpetual diff on destination_flow_config #34770

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/34770.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_appflow_flow: Fix perpetual diff on `destination_flow_config`
```
18 changes: 14 additions & 4 deletions internal/service/appflow/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func resourceFlow() *schema.Resource {
ValidateFunc: validation.StringMatch(regexache.MustCompile(`[\w!@#\-.?,\s]*`), "must contain only alphanumeric, underscore (_), exclamation point (!), at sign (@), number sign (#), hyphen (-), period (.), question mark (?), comma (,), and whitespace characters"),
},
"destination_flow_config": {
Type: schema.TypeSet,
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -331,6 +331,7 @@ func resourceFlow() *schema.Resource {
"s3": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand All @@ -342,23 +343,27 @@ func resourceFlow() *schema.Resource {
"bucket_prefix": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringLenBetween(0, 512),
},
"s3_output_format_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"aggregation_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"aggregation_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateDiagFunc: enum.Validate[types.AggregationType](),
},
},
Expand All @@ -372,6 +377,7 @@ func resourceFlow() *schema.Resource {
"prefix_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand All @@ -391,6 +397,7 @@ func resourceFlow() *schema.Resource {
"preserve_source_data_typing": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
},
},
Expand Down Expand Up @@ -853,17 +860,20 @@ func resourceFlow() *schema.Resource {
"s3": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bucket_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)),
},
"bucket_prefix": {
Type: schema.TypeString,
Optional: true,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringLenBetween(0, 512),
},
"s3_input_format_config": {
Expand Down Expand Up @@ -1232,7 +1242,7 @@ func resourceFlowCreate(ctx context.Context, d *schema.ResourceData, meta interf
name := d.Get(names.AttrName).(string)
input := &appflow.CreateFlowInput{
FlowName: aws.String(name),
DestinationFlowConfigList: expandDestinationFlowConfigs(d.Get("destination_flow_config").(*schema.Set).List()),
DestinationFlowConfigList: expandDestinationFlowConfigs(d.Get("destination_flow_config").([]interface{})),
SourceFlowConfig: expandSourceFlowConfig(d.Get("source_flow_config").([]interface{})[0].(map[string]interface{})),
Tags: getTagsIn(ctx),
Tasks: expandTasks(d.Get("task").(*schema.Set).List()),
Expand Down Expand Up @@ -1318,7 +1328,7 @@ func resourceFlowUpdate(ctx context.Context, d *schema.ResourceData, meta interf

if d.HasChangesExcept("tags", "tags_all") {
input := &appflow.UpdateFlowInput{
DestinationFlowConfigList: expandDestinationFlowConfigs(d.Get("destination_flow_config").(*schema.Set).List()),
DestinationFlowConfigList: expandDestinationFlowConfigs(d.Get("destination_flow_config").([]interface{})),
FlowName: aws.String(d.Get(names.AttrName).(string)),
SourceFlowConfig: expandSourceFlowConfig(d.Get("source_flow_config").([]interface{})[0].(map[string]interface{})),
Tasks: expandTasks(d.Get("task").(*schema.Set).List()),
Expand Down
Loading