diff --git a/fivetran/framework/datasources/group_connectors.go b/fivetran/framework/datasources/group_connectors.go index c8e3dcbf..acd3bb97 100644 --- a/fivetran/framework/datasources/group_connectors.go +++ b/fivetran/framework/datasources/group_connectors.go @@ -7,6 +7,7 @@ import ( "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core" "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/model" "github.com/hashicorp/terraform-plugin-framework/datasource" + sdk "github.com/fivetran/go-fivetran/groups" fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" ) @@ -41,26 +42,43 @@ func (d *groupConnectors) Read(ctx context.Context, req datasource.ReadRequest, } var data model.GroupConnectors - resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - svc := d.GetClient().NewGroupListConnectors().GroupID(data.Id.ValueString()) - - if !data.Schema.IsNull() { - svc.Schema(data.Schema.ValueString()) - } - - groupConnectorsResponse, err := svc.Do(ctx) - - if err != nil { - resp.Diagnostics.AddError( - "Read error.", - fmt.Sprintf("%v; code: %v; message: %v", err, groupConnectorsResponse.Code, groupConnectorsResponse.Message), - ) - return + var respNextCursor string + var listResponse sdk.GroupListConnectorsResponse + limit := 1000 + + for { + var err error + var tmpResp sdk.GroupListConnectorsResponse + svc := d.GetClient().NewGroupListConnectors() + + if respNextCursor == "" { + tmpResp, err = svc.Limit(limit).GroupID(data.Id.ValueString()).Do(ctx) + } + + if respNextCursor != "" { + tmpResp, err = svc.Limit(limit).GroupID(data.Id.ValueString()).Cursor(respNextCursor).Do(ctx) + } + + if err != nil { + resp.Diagnostics.AddError( + "Read error.", + fmt.Sprintf("%v; code: %v; message: %v", err, tmpResp.Code, tmpResp.Message), + ) + listResponse = sdk.GroupListConnectorsResponse{} + } + + listResponse.Data.Items = append(listResponse.Data.Items, tmpResp.Data.Items...) + + if tmpResp.Data.NextCursor == "" { + break + } + + respNextCursor = tmpResp.Data.NextCursor } - data.ReadFromResponse(ctx, groupConnectorsResponse) + data.ReadFromResponse(ctx, listResponse) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } diff --git a/fivetran/tests/e2e/resource_dbt_project_e2e_test.go b/fivetran/tests/e2e/resource_dbt_project_e2e_test.go index 79e8cfeb..47ba767b 100644 --- a/fivetran/tests/e2e/resource_dbt_project_e2e_test.go +++ b/fivetran/tests/e2e/resource_dbt_project_e2e_test.go @@ -12,7 +12,7 @@ import ( ) func TestResourceDbtProjectE2E(t *testing.T) { - //t.Skip("Now for deployment you need to use a third-party provider, which is impossible to do inside the local provider test") + t.Skip("Skip cause deprecated in upstream.") destinationConfig := ` resource "fivetran_destination" "test_destination" { provider = fivetran-provider diff --git a/fivetran/tests/e2e/resource_dbt_transformation_e2e_test.go b/fivetran/tests/e2e/resource_dbt_transformation_e2e_test.go index 62e6c639..4c2141bd 100644 --- a/fivetran/tests/e2e/resource_dbt_transformation_e2e_test.go +++ b/fivetran/tests/e2e/resource_dbt_transformation_e2e_test.go @@ -11,7 +11,7 @@ import ( ) func TestResourceDbtTransformationE2E(t *testing.T) { - t.Skip("Reason: T-705448 (issues with Github auth for project)") + t.Skip("Skip cause deprecated in upstream.") destinationConfig := ` resource "fivetran_destination" "test_destination" { provider = fivetran-provider