From d06a3c021d986100509e8a4ddaa38bd99ea57c01 Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Mon, 19 Aug 2024 14:41:45 -0700 Subject: [PATCH 01/11] Stop connecting sources and warehouses by default --- go.mod | 2 +- go.sum | 2 ++ internal/provider/source_resource.go | 11 +++++++---- internal/provider/warehouse_resource.go | 11 +++++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 6255c43..7fe5b8f 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 - github.com/segmentio/public-api-sdk-go v0.0.0-20231114153454-3be55fde5c99 + github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028 gotest.tools/gotestsum v1.12.0 ) diff --git a/go.sum b/go.sum index 0b4939d..43c3b8a 100644 --- a/go.sum +++ b/go.sum @@ -187,6 +187,8 @@ github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3V github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/segmentio/public-api-sdk-go v0.0.0-20231114153454-3be55fde5c99 h1:55dfJRsEeZLLFln+0gQ1pNZvalFMyeMV9nTPQwShkok= github.com/segmentio/public-api-sdk-go v0.0.0-20231114153454-3be55fde5c99/go.mod h1:1mLoKkR7t90unwNx7qx9PicO3AX5NflFD7ny3TvLExU= +github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028 h1:mY+y1F+uVH9D2rGZDzrJf8fNaoGAWXMKNz857VYpc3k= +github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= diff --git a/internal/provider/source_resource.go b/internal/provider/source_resource.go index d0d6615..f27ef9c 100644 --- a/internal/provider/source_resource.go +++ b/internal/provider/source_resource.go @@ -276,11 +276,14 @@ func (r *sourceResource) Create(ctx context.Context, req resource.CreateRequest, return } + disconnectAllWarehouses := true + out, body, err := r.client.SourcesAPI.CreateSource(r.authContext).CreateSourceV1Input(api.CreateSourceV1Input{ - Slug: plan.Slug.ValueString(), - Enabled: plan.Enabled.ValueBool(), - MetadataId: metadataID, - Settings: settings, + Slug: plan.Slug.ValueString(), + Enabled: plan.Enabled.ValueBool(), + MetadataId: metadataID, + Settings: settings, + DisconnectAllWarehouses: &disconnectAllWarehouses, }).Execute() if body != nil { defer body.Body.Close() diff --git a/internal/provider/warehouse_resource.go b/internal/provider/warehouse_resource.go index ed4191d..17413b5 100644 --- a/internal/provider/warehouse_resource.go +++ b/internal/provider/warehouse_resource.go @@ -219,11 +219,14 @@ func (r *warehouseResource) Create(ctx context.Context, req resource.CreateReque name = nil } + disconnectAllSources := true + out, body, err := r.client.WarehousesAPI.CreateWarehouse(r.authContext).CreateWarehouseV1Input(api.CreateWarehouseV1Input{ - Enabled: plan.Enabled.ValueBoolPointer(), - MetadataId: metadataID, - Settings: settings, - Name: name, + Enabled: plan.Enabled.ValueBoolPointer(), + MetadataId: metadataID, + Settings: settings, + Name: name, + DisconnectAllSources: &disconnectAllSources, }).Execute() if body != nil { defer body.Body.Close() From bc8df2f2dd82898532f0f2fa545151d2b914d83a Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Tue, 20 Aug 2024 14:45:22 -0700 Subject: [PATCH 02/11] Stop default source and warehouse connections and upgrade Public API SDK --- go.mod | 2 +- go.sum | 8 ++++---- internal/provider/function_resource.go | 4 ++-- internal/provider/models/function.go | 2 +- internal/provider/models/reverse_etl_model.go | 19 ++++++++++++++++++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 7fe5b8f..c71e301 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 - github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028 + github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a gotest.tools/gotestsum v1.12.0 ) diff --git a/go.sum b/go.sum index 43c3b8a..d180525 100644 --- a/go.sum +++ b/go.sum @@ -185,10 +185,10 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= -github.com/segmentio/public-api-sdk-go v0.0.0-20231114153454-3be55fde5c99 h1:55dfJRsEeZLLFln+0gQ1pNZvalFMyeMV9nTPQwShkok= -github.com/segmentio/public-api-sdk-go v0.0.0-20231114153454-3be55fde5c99/go.mod h1:1mLoKkR7t90unwNx7qx9PicO3AX5NflFD7ny3TvLExU= -github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028 h1:mY+y1F+uVH9D2rGZDzrJf8fNaoGAWXMKNz857VYpc3k= -github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= +github.com/segmentio/public-api-sdk-go v0.0.0-20240820173358-a52384e5ccc7 h1:04d9X+Bw1RY+lmbs0DajdA61xSQOZCAIUJuZfcFpz0g= +github.com/segmentio/public-api-sdk-go v0.0.0-20240820173358-a52384e5ccc7/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= +github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a h1:vSCltBxaOD5NRP3zGh/Xha3evkt0ZeXdAc6fTDTuwzg= +github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= diff --git a/internal/provider/function_resource.go b/internal/provider/function_resource.go index 64f8f1a..7759f74 100644 --- a/internal/provider/function_resource.go +++ b/internal/provider/function_resource.go @@ -159,7 +159,7 @@ func (r *functionResource) Create(ctx context.Context, req resource.CreateReques resp.State.SetAttribute(ctx, path.Root("id"), function.Id) var state models.FunctionState - state.Fill(api.Function(function)) + state.Fill(api.FunctionV1(function)) // Destination functions append workspace name to display name causing inconsistency if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" { @@ -256,7 +256,7 @@ func (r *functionResource) Update(ctx context.Context, req resource.UpdateReques function := out.Data.GetFunction() - state.Fill(api.Function(function)) + state.Fill(api.FunctionV1(function)) // Destination functions append workspace name to display name causing inconsistency if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" { diff --git a/internal/provider/models/function.go b/internal/provider/models/function.go index a37be64..62b5fc3 100644 --- a/internal/provider/models/function.go +++ b/internal/provider/models/function.go @@ -41,7 +41,7 @@ type FunctionPlan struct { Settings types.Set `tfsdk:"settings"` } -func (f *FunctionState) Fill(function api.Function) { +func (f *FunctionState) Fill(function api.FunctionV1) { f.ID = types.StringPointerValue(function.Id) f.Code = types.StringPointerValue(function.Code) f.DisplayName = types.StringPointerValue(function.DisplayName) diff --git a/internal/provider/models/reverse_etl_model.go b/internal/provider/models/reverse_etl_model.go index 69fbcd6..56b313a 100644 --- a/internal/provider/models/reverse_etl_model.go +++ b/internal/provider/models/reverse_etl_model.go @@ -27,7 +27,7 @@ func (r *ReverseETLModelState) Fill(model api.ReverseEtlModel) error { r.ScheduleStrategy = types.StringValue(model.ScheduleStrategy) r.Query = types.StringValue(model.Query) r.QueryIdentifierColumn = types.StringValue(model.QueryIdentifierColumn) - scheduleConfig, err := GetSettings(model.ScheduleConfig) + scheduleConfig, err := GetScheduleConfig(model.ScheduleConfig) if err != nil { return err } @@ -39,3 +39,20 @@ func (r *ReverseETLModelState) Fill(model api.ReverseEtlModel) error { return nil } + +func GetScheduleConfig(scheduleConfig api.NullableScheduleConfig) (jsontypes.Normalized, error) { + if !scheduleConfig.IsSet() { + return jsontypes.NewNormalizedNull(), nil + } + + jsonScheduleConfigString, err := scheduleConfig.Get().MarshalJSON() + if err != nil { + return jsontypes.NewNormalizedNull(), err + } + + if jsonScheduleConfigString == nil { + return jsontypes.NewNormalizedValue("{}"), nil + } + + return jsontypes.NewNormalizedValue(string(jsonScheduleConfigString)), nil +} From 839050ff538e8f9df4f5c3cfb79c4a52974b53da Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Tue, 20 Aug 2024 15:25:35 -0700 Subject: [PATCH 03/11] Update changelog --- CHANGELOG.md | 3 +++ internal/provider/models/reverse_etl_model.go | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf643e4..6194a5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.1.0 (August 20, 2024) +Stops connecting newly created sources and warehouses by default. + ## 1.0.5 (August 12, 2024) Fixes a bug where user groups could not be cleared. diff --git a/internal/provider/models/reverse_etl_model.go b/internal/provider/models/reverse_etl_model.go index 56b313a..6ffd599 100644 --- a/internal/provider/models/reverse_etl_model.go +++ b/internal/provider/models/reverse_etl_model.go @@ -1,6 +1,9 @@ package models import ( + "encoding/json" + "errors" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/segmentio/public-api-sdk-go/api" @@ -45,7 +48,8 @@ func GetScheduleConfig(scheduleConfig api.NullableScheduleConfig) (jsontypes.Nor return jsontypes.NewNormalizedNull(), nil } - jsonScheduleConfigString, err := scheduleConfig.Get().MarshalJSON() + jsonScheduleConfigString, err := json.Marshal(scheduleConfig) + return jsontypes.NewNormalizedNull(), errors.New(string(jsonScheduleConfigString)) if err != nil { return jsontypes.NewNormalizedNull(), err } From 8eaac001714a776464110be11ab7535d0781afa0 Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Tue, 20 Aug 2024 15:27:15 -0700 Subject: [PATCH 04/11] Revert accidental change --- internal/provider/models/reverse_etl_model.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/internal/provider/models/reverse_etl_model.go b/internal/provider/models/reverse_etl_model.go index 6ffd599..56b313a 100644 --- a/internal/provider/models/reverse_etl_model.go +++ b/internal/provider/models/reverse_etl_model.go @@ -1,9 +1,6 @@ package models import ( - "encoding/json" - "errors" - "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/segmentio/public-api-sdk-go/api" @@ -48,8 +45,7 @@ func GetScheduleConfig(scheduleConfig api.NullableScheduleConfig) (jsontypes.Nor return jsontypes.NewNormalizedNull(), nil } - jsonScheduleConfigString, err := json.Marshal(scheduleConfig) - return jsontypes.NewNormalizedNull(), errors.New(string(jsonScheduleConfigString)) + jsonScheduleConfigString, err := scheduleConfig.Get().MarshalJSON() if err != nil { return jsontypes.NewNormalizedNull(), err } From 917cd1291bba198600b3005410c7b340ef61323b Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Tue, 20 Aug 2024 15:28:31 -0700 Subject: [PATCH 05/11] Fix lint errors --- internal/provider/function_resource.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/provider/function_resource.go b/internal/provider/function_resource.go index 7759f74..c312660 100644 --- a/internal/provider/function_resource.go +++ b/internal/provider/function_resource.go @@ -159,7 +159,7 @@ func (r *functionResource) Create(ctx context.Context, req resource.CreateReques resp.State.SetAttribute(ctx, path.Root("id"), function.Id) var state models.FunctionState - state.Fill(api.FunctionV1(function)) + state.Fill(function) // Destination functions append workspace name to display name causing inconsistency if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" { @@ -256,7 +256,7 @@ func (r *functionResource) Update(ctx context.Context, req resource.UpdateReques function := out.Data.GetFunction() - state.Fill(api.FunctionV1(function)) + state.Fill(function) // Destination functions append workspace name to display name causing inconsistency if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" { From fdbfc1fb465ff76be0cb2b61af66de0392f8da2f Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Thu, 5 Sep 2024 11:33:45 -0700 Subject: [PATCH 06/11] Upgrade sdk --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c71e301..902f688 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 - github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a + github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da gotest.tools/gotestsum v1.12.0 ) diff --git a/go.sum b/go.sum index d180525..809770f 100644 --- a/go.sum +++ b/go.sum @@ -189,6 +189,8 @@ github.com/segmentio/public-api-sdk-go v0.0.0-20240820173358-a52384e5ccc7 h1:04d github.com/segmentio/public-api-sdk-go v0.0.0-20240820173358-a52384e5ccc7/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a h1:vSCltBxaOD5NRP3zGh/Xha3evkt0ZeXdAc6fTDTuwzg= github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= +github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da h1:SiFK2+vk+r2zEfUUZm2FbfY6F050L5zPzKsCGlvdUg4= +github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= From 92946eb720fc7063e9d01baddbee7ca85379a690 Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Thu, 5 Sep 2024 16:25:38 -0700 Subject: [PATCH 07/11] Upgrade sdk --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 902f688..71cdd74 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 - github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da + github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56 gotest.tools/gotestsum v1.12.0 ) diff --git a/go.sum b/go.sum index 809770f..8d6893e 100644 --- a/go.sum +++ b/go.sum @@ -191,6 +191,8 @@ github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a h1:vSC github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da h1:SiFK2+vk+r2zEfUUZm2FbfY6F050L5zPzKsCGlvdUg4= github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= +github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56 h1:IKxTy9Mw02je+m8AhpnYaKqrrjzBzHRn+Y99C4kGsEo= +github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= From a03aec1a6af3cbd1678b6b0fbccc1eae5e0158b9 Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Thu, 5 Sep 2024 16:28:38 -0700 Subject: [PATCH 08/11] Fix type issue --- internal/provider/function_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/provider/function_resource.go b/internal/provider/function_resource.go index c312660..d09b093 100644 --- a/internal/provider/function_resource.go +++ b/internal/provider/function_resource.go @@ -200,7 +200,7 @@ func (r *functionResource) Read(ctx context.Context, req resource.ReadRequest, r var state models.FunctionState function := response.Data.GetFunction() - state.Fill(function) + state.Fill(api.FunctionV1(function)) // Destination functions append workspace name to display name causing inconsistency if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" { From e517f94f3733ada7d236fa7e8aa87fea92f52775 Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Mon, 9 Sep 2024 13:31:33 -0700 Subject: [PATCH 09/11] Use latest sdk --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 71cdd74..69356fb 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 - github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56 + github.com/segmentio/public-api-sdk-go v0.0.0-20240906231017-4e91c4889f50 gotest.tools/gotestsum v1.12.0 ) diff --git a/go.sum b/go.sum index 8d6893e..43c469d 100644 --- a/go.sum +++ b/go.sum @@ -193,6 +193,8 @@ github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da h1:SiF github.com/segmentio/public-api-sdk-go v0.0.0-20240905000934-07e8214ff9da/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56 h1:IKxTy9Mw02je+m8AhpnYaKqrrjzBzHRn+Y99C4kGsEo= github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= +github.com/segmentio/public-api-sdk-go v0.0.0-20240906231017-4e91c4889f50 h1:RsFkUN2lGzupgzXLsWdDdvsPp1oj6kwHLgucV77MPCk= +github.com/segmentio/public-api-sdk-go v0.0.0-20240906231017-4e91c4889f50/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= From 46f04e654c7f00d38fb6fd11c2ea6976d6ef1b27 Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Mon, 9 Sep 2024 13:50:54 -0700 Subject: [PATCH 10/11] Use latest sdk --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 69356fb..3996bcd 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 - github.com/segmentio/public-api-sdk-go v0.0.0-20240906231017-4e91c4889f50 + github.com/segmentio/public-api-sdk-go v0.0.0-20240909200753-311bb8d791a2 gotest.tools/gotestsum v1.12.0 ) diff --git a/go.sum b/go.sum index 43c469d..7478498 100644 --- a/go.sum +++ b/go.sum @@ -195,6 +195,10 @@ github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56 h1:IKx github.com/segmentio/public-api-sdk-go v0.0.0-20240905231636-2922a096fe56/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/segmentio/public-api-sdk-go v0.0.0-20240906231017-4e91c4889f50 h1:RsFkUN2lGzupgzXLsWdDdvsPp1oj6kwHLgucV77MPCk= github.com/segmentio/public-api-sdk-go v0.0.0-20240906231017-4e91c4889f50/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= +github.com/segmentio/public-api-sdk-go v0.0.0-20240906235131-c22dd0e0d0b9 h1:g8gpxgqCPsFvOKhu55fPXl6H3wNm0CdbOH8cNri/1Fs= +github.com/segmentio/public-api-sdk-go v0.0.0-20240906235131-c22dd0e0d0b9/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= +github.com/segmentio/public-api-sdk-go v0.0.0-20240909200753-311bb8d791a2 h1:vlKTelJ32DPBuiiSx2PJaxN9jJd3OFK2avHU/XR/qB8= +github.com/segmentio/public-api-sdk-go v0.0.0-20240909200753-311bb8d791a2/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= From 9732dcb4edb54871147dc0c587c71d385c00274f Mon Sep 17 00:00:00 2001 From: Dean Huynh Date: Mon, 9 Sep 2024 14:02:06 -0700 Subject: [PATCH 11/11] Fix lint error --- internal/provider/function_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/provider/function_resource.go b/internal/provider/function_resource.go index d09b093..c312660 100644 --- a/internal/provider/function_resource.go +++ b/internal/provider/function_resource.go @@ -200,7 +200,7 @@ func (r *functionResource) Read(ctx context.Context, req resource.ReadRequest, r var state models.FunctionState function := response.Data.GetFunction() - state.Fill(api.FunctionV1(function)) + state.Fill(function) // Destination functions append workspace name to display name causing inconsistency if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" {