From a5f54fb7c790d92e8cd06baf3c69a645c1e81399 Mon Sep 17 00:00:00 2001 From: Tushar Pandit Date: Fri, 15 Dec 2023 10:22:15 -0600 Subject: [PATCH 1/4] add flow_status to aws_appflow_flow --- internal/service/appflow/flow.go | 5 +++++ website/docs/cdktf/python/r/appflow_flow.html.markdown | 1 + website/docs/r/appflow_flow.html.markdown | 1 + 3 files changed, 7 insertions(+) diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index 4f807f3b7547..21238d79330c 100644 --- a/internal/service/appflow/flow.go +++ b/internal/service/appflow/flow.go @@ -700,6 +700,11 @@ func resourceFlow() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`arn:.*:kms:.*:[0-9]+:.*`), "must be a valid ARN of a Key Management Services (KMS) key"), }, + "flow_status": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.FlowStatus](), + }, names.AttrName: { Type: schema.TypeString, Required: true, diff --git a/website/docs/cdktf/python/r/appflow_flow.html.markdown b/website/docs/cdktf/python/r/appflow_flow.html.markdown index 622cacdc3721..d9eebfe8cc1d 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 971ca6ed0be7..38bcc4908f8b 100644 --- a/website/docs/r/appflow_flow.html.markdown +++ b/website/docs/r/appflow_flow.html.markdown @@ -142,6 +142,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 From d2b85bf365088e862d78c8c92583c31ed97828da Mon Sep 17 00:00:00 2001 From: Tushar Pandit Date: Fri, 15 Dec 2023 10:48:37 -0600 Subject: [PATCH 2/4] format flow.go using gofmt ./internal/service/appflow/flow.go --- internal/service/appflow/flow.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index 21238d79330c..6ab2d8db8b67 100644 --- a/internal/service/appflow/flow.go +++ b/internal/service/appflow/flow.go @@ -701,8 +701,8 @@ func resourceFlow() *schema.Resource { ValidateFunc: validation.StringMatch(regexache.MustCompile(`arn:.*:kms:.*:[0-9]+:.*`), "must be a valid ARN of a Key Management Services (KMS) key"), }, "flow_status": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, ValidateDiagFunc: enum.Validate[types.FlowStatus](), }, names.AttrName: { From 503402dedb22f83c6252db72a5a5ddca79f1a921 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 25 Jan 2024 08:28:28 -0500 Subject: [PATCH 3/4] Add CHANGELOG entry. --- .changelog/34948.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/34948.txt diff --git a/.changelog/34948.txt b/.changelog/34948.txt new file mode 100644 index 000000000000..09c2386ebb37 --- /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 From 446f388bf303ae66cd322ea6b1589be6e71a52e1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 25 Jan 2024 08:33:35 -0500 Subject: [PATCH 4/4] r/aws_appflow_flow: 'flow_status' is Computed. --- internal/service/appflow/flow.go | 26 ++++++++++------------- internal/service/appflow/flow_test.go | 4 ++-- website/docs/r/appflow_flow.html.markdown | 4 ++-- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index 7cadf6d7f476..33cbde525969 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, @@ -705,11 +705,6 @@ func resourceFlow() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`arn:.*:kms:.*:[0-9]+:.*`), "must be a valid ARN of a Key Management Services (KMS) key"), }, - "flow_status": { - Type: schema.TypeString, - Optional: true, - ValidateDiagFunc: enum.Validate[types.FlowStatus](), - }, names.AttrName: { Type: schema.TypeString, Required: true, @@ -931,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)), @@ -1306,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 { @@ -1880,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) } @@ -2294,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) } @@ -2966,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 { @@ -3365,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 79a238fe1810..13b5addeca05 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/r/appflow_flow.html.markdown b/website/docs/r/appflow_flow.html.markdown index 9f009d1f9eaa..7761c4fb54e8 100644 --- a/website/docs/r/appflow_flow.html.markdown +++ b/website/docs/r/appflow_flow.html.markdown @@ -141,8 +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). -* `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 @@ -398,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