diff --git a/.changelog/34948.txt b/.changelog/34948.txt new file mode 100644 index 00000000000..09c2386ebb3 --- /dev/null +++ b/.changelog/34948.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_appflow_flow: Add `flow_status` attribute +``` \ No newline at end of file diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index 948fda455ee..33cbde52596 100644 --- a/internal/service/appflow/flow.go +++ b/internal/service/appflow/flow.go @@ -28,10 +28,6 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -const ( - AttrObjectPath = "object_path" -) - // @SDKResource("aws_appflow_flow", name="Flow") // @Tags(identifierAttribute="id") func resourceFlow() *schema.Resource { @@ -497,7 +493,7 @@ func resourceFlow() *schema.Resource { ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(0, 128)), }, }, - AttrObjectPath: { + "object_path": { Type: schema.TypeString, Required: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(1, 512)), @@ -698,6 +694,10 @@ func resourceFlow() *schema.Resource { }, }, }, + "flow_status": { + Type: schema.TypeString, + Computed: true, + }, "kms_arn": { Type: schema.TypeString, Optional: true, @@ -926,7 +926,7 @@ func resourceFlow() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - AttrObjectPath: { + "object_path": { Type: schema.TypeString, Required: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(1, 512)), @@ -1301,6 +1301,7 @@ func resourceFlowRead(ctx context.Context, d *schema.ResourceData, meta interfac if err := d.Set("destination_flow_config", flattenDestinationFlowConfigs(output.DestinationFlowConfigList)); err != nil { return sdkdiag.AppendErrorf(diags, "setting destination_flow_config: %s", err) } + d.Set("flow_status", output.FlowStatus) d.Set("kms_arn", output.KmsArn) d.Set(names.AttrName, output.FlowName) if output.SourceFlowConfig != nil { @@ -1875,7 +1876,7 @@ func expandSAPODataDestinationProperties(tfMap map[string]interface{}) *types.SA a.IdFieldNames = flex.ExpandStringValueList(v) } - if v, ok := tfMap[AttrObjectPath].(string); ok && v != "" { + if v, ok := tfMap["object_path"].(string); ok && v != "" { a.ObjectPath = aws.String(v) } @@ -2289,7 +2290,7 @@ func expandSAPODataSourceProperties(tfMap map[string]interface{}) *types.SAPODat a := &types.SAPODataSourceProperties{} - if v, ok := tfMap[AttrObjectPath].(string); ok && v != "" { + if v, ok := tfMap["object_path"].(string); ok && v != "" { a.ObjectPath = aws.String(v) } @@ -2961,7 +2962,7 @@ func flattenSAPODataDestinationProperties(SAPODataDestinationProperties *types.S } if v := SAPODataDestinationProperties.ObjectPath; v != nil { - m[AttrObjectPath] = aws.ToString(v) + m["object_path"] = aws.ToString(v) } if v := SAPODataDestinationProperties.SuccessResponseHandlingConfig; v != nil { @@ -3360,7 +3361,7 @@ func flattenSAPODataSourceProperties(sapoDataSourceProperties *types.SAPODataSou m := map[string]interface{}{} if v := sapoDataSourceProperties.ObjectPath; v != nil { - m[AttrObjectPath] = aws.ToString(v) + m["object_path"] = aws.ToString(v) } return m diff --git a/internal/service/appflow/flow_test.go b/internal/service/appflow/flow_test.go index 79a238fe181..13b5addeca0 100644 --- a/internal/service/appflow/flow_test.go +++ b/internal/service/appflow/flow_test.go @@ -45,9 +45,11 @@ func TestAccAppFlowFlow_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "destination_flow_config.#"), resource.TestCheckResourceAttrSet(resourceName, "destination_flow_config.0.connector_type"), resource.TestCheckResourceAttrSet(resourceName, "destination_flow_config.0.destination_connector_properties.#"), + resource.TestCheckResourceAttrSet(resourceName, "flow_status"), resource.TestCheckResourceAttrSet(resourceName, "source_flow_config.#"), resource.TestCheckResourceAttrSet(resourceName, "source_flow_config.0.connector_type"), resource.TestCheckResourceAttrSet(resourceName, "source_flow_config.0.source_connector_properties.#"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "task.#"), resource.TestCheckResourceAttrSet(resourceName, "task.0.source_fields.#"), resource.TestCheckResourceAttrSet(resourceName, "task.0.task_type"), @@ -58,8 +60,6 @@ func TestAccAppFlowFlow_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_properties.0.scheduled.0.data_pull_mode", "Incremental"), resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_properties.0.scheduled.0.schedule_expression", "rate(3hours)"), resource.TestCheckResourceAttr(resourceName, "trigger_config.0.trigger_properties.0.scheduled.0.schedule_start_time", scheduleStartTime), - resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), ), }, { diff --git a/website/docs/cdktf/python/r/appflow_flow.html.markdown b/website/docs/cdktf/python/r/appflow_flow.html.markdown index 22bfaabf222..fba25753bda 100644 --- a/website/docs/cdktf/python/r/appflow_flow.html.markdown +++ b/website/docs/cdktf/python/r/appflow_flow.html.markdown @@ -145,6 +145,7 @@ This resource supports the following arguments: * `kms_arn` - (Optional) ARN (Amazon Resource Name) of the Key Management Service (KMS) key you provide for encryption. This is required if you do not want to use the Amazon AppFlow-managed KMS key. If you don't provide anything here, Amazon AppFlow uses the Amazon AppFlow-managed KMS key. * `tags` - (Optional) Key-value mapping of resource tags. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). +* `flow_status` - (Optional) Set the status of the flow ([`could be Active, Suspended, Draft` https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appflow-flow.html ] ) ### Destination Flow Config diff --git a/website/docs/r/appflow_flow.html.markdown b/website/docs/r/appflow_flow.html.markdown index 4600afcd7fb..7761c4fb54e 100644 --- a/website/docs/r/appflow_flow.html.markdown +++ b/website/docs/r/appflow_flow.html.markdown @@ -141,7 +141,6 @@ This resource supports the following arguments: * `description` - (Optional) Description of the flow you want to create. * `kms_arn` - (Optional) ARN (Amazon Resource Name) of the Key Management Service (KMS) key you provide for encryption. This is required if you do not want to use the Amazon AppFlow-managed KMS key. If you don't provide anything here, Amazon AppFlow uses the Amazon AppFlow-managed KMS key. * `tags` - (Optional) Key-value mapping of resource tags. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. -* `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ### Destination Flow Config @@ -397,6 +396,8 @@ resource "aws_appflow_flow" "example" { This resource exports the following attributes in addition to the arguments above: * `arn` - Flow's ARN. +* `flow_status` - The current status of the flow. +* `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ## Import