diff --git a/.changelog/34770.txt b/.changelog/34770.txt new file mode 100644 index 00000000000..0d154a795eb --- /dev/null +++ b/.changelog/34770.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_appflow_flow: Fix perpetual diff on `destination_flow_config` +``` \ No newline at end of file diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index 0ad6d73500b..4f807f3b754 100644 --- a/internal/service/appflow/flow.go +++ b/internal/service/appflow/flow.go @@ -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{ @@ -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{ @@ -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](), }, }, @@ -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{ @@ -391,6 +397,7 @@ func resourceFlow() *schema.Resource { "preserve_source_data_typing": { Type: schema.TypeBool, Optional: true, + Computed: true, }, }, }, @@ -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": { @@ -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()), @@ -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()),