@@ -66,6 +66,11 @@ func (r *sourceWarehouseConnectionResource) Create(ctx context.Context, req reso
6666 return
6767 }
6868
69+ if plan .WarehouseID .String () == "" || plan .SourceID .String () == "" {
70+ resp .Diagnostics .AddError ("Unable to create connection between Source and Warehouse" , "At least one ID is empty" )
71+ return
72+ }
73+
6974 _ , body , err := r .client .WarehousesApi .AddConnectionFromSourceToWarehouse (r .authContext , plan .WarehouseID .ValueString (), plan .SourceID .ValueString ()).Execute ()
7075 if err != nil {
7176 resp .Diagnostics .AddError (
@@ -101,6 +106,10 @@ func (d *sourceWarehouseConnectionResource) Read(ctx context.Context, req resour
101106 paginationNext := "MA=="
102107
103108 for paginationNext != "" {
109+ if state .SourceID .String () == "" {
110+ resp .Diagnostics .AddError ("Unable to read Source-Warehouse connection" , "At least one ID is empty" )
111+ return
112+ }
104113 response , body , err := d .client .SourcesApi .ListConnectedWarehousesFromSource (d .authContext , state .SourceID .ValueString ()).Pagination (api.PaginationInput {
105114 Cursor : & paginationNext ,
106115 Count : 200 ,
@@ -154,6 +163,11 @@ func (r *sourceWarehouseConnectionResource) Delete(ctx context.Context, req reso
154163 return
155164 }
156165
166+ if config .WarehouseID .String () == "" || config .SourceID .String () == "" {
167+ resp .Diagnostics .AddError ("Unable to remove Source-Warehouse connection" , "At least one ID is empty" )
168+ return
169+ }
170+
157171 _ , body , err := r .client .WarehousesApi .RemoveSourceConnectionFromWarehouse (r .authContext , config .WarehouseID .ValueString (), config .SourceID .ValueString ()).Execute ()
158172 if err != nil {
159173 resp .Diagnostics .AddError (
0 commit comments