@@ -98,24 +98,13 @@ func (r *reverseETLModelResource) Create(ctx context.Context, req resource.Creat
9898 return
9999 }
100100
101- var scheduleConfig map [string ]interface {}
102- if ! plan .ScheduleConfig .IsNull () && ! plan .ScheduleConfig .IsUnknown () {
103- diags = plan .ScheduleConfig .Unmarshal (& scheduleConfig )
104- resp .Diagnostics .Append (diags ... )
105- if resp .Diagnostics .HasError () {
106- return
107- }
108- }
109-
110101 out , body , err := r .client .ReverseETLAPI .CreateReverseEtlModel (r .authContext ).CreateReverseEtlModelInput (api.CreateReverseEtlModelInput {
111102 Name : plan .Name .ValueString (),
112103 SourceId : plan .SourceID .ValueString (),
113104 Description : plan .Description .ValueString (),
114105 Enabled : plan .Enabled .ValueBool (),
115- ScheduleStrategy : plan .ScheduleStrategy .ValueString (),
116106 Query : plan .Query .ValueString (),
117107 QueryIdentifierColumn : plan .QueryIdentifierColumn .ValueString (),
118- ScheduleConfig : scheduleConfig ,
119108 }).Execute ()
120109 if body != nil {
121110 defer body .Body .Close ()
@@ -150,6 +139,10 @@ func (r *reverseETLModelResource) Create(ctx context.Context, req resource.Creat
150139 if resp .Diagnostics .HasError () {
151140 return
152141 }
142+
143+ // Since we deprecated these values, we just need to set them to the plan values so there are no errors
144+ resp .State .SetAttribute (ctx , path .Root ("schedule_config" ), plan .ScheduleConfig )
145+ resp .State .SetAttribute (ctx , path .Root ("schedule_strategy" ), plan .ScheduleStrategy )
153146}
154147
155148func (r * reverseETLModelResource ) Read (ctx context.Context , req resource.ReadRequest , resp * resource.ReadResponse ) {
@@ -192,6 +185,14 @@ func (r *reverseETLModelResource) Read(ctx context.Context, req resource.ReadReq
192185 if resp .Diagnostics .HasError () {
193186 return
194187 }
188+
189+ // Since we deprecated these values, we just need to set them to the plan values so there are no errors
190+ if ! previousState .ScheduleConfig .IsNull () && ! previousState .ScheduleConfig .IsUnknown () {
191+ resp .State .SetAttribute (ctx , path .Root ("schedule_config" ), previousState .ScheduleConfig )
192+ }
193+ if ! previousState .ScheduleStrategy .IsNull () && ! previousState .ScheduleStrategy .IsUnknown () {
194+ resp .State .SetAttribute (ctx , path .Root ("schedule_strategy" ), previousState .ScheduleStrategy )
195+ }
195196}
196197
197198func (r * reverseETLModelResource ) Update (ctx context.Context , req resource.UpdateRequest , resp * resource.UpdateResponse ) {
@@ -209,19 +210,10 @@ func (r *reverseETLModelResource) Update(ctx context.Context, req resource.Updat
209210 return
210211 }
211212
212- var scheduleConfig map [string ]interface {}
213- diags = plan .ScheduleConfig .Unmarshal (& scheduleConfig )
214- resp .Diagnostics .Append (diags ... )
215- if resp .Diagnostics .HasError () {
216- return
217- }
218-
219213 out , body , err := r .client .ReverseETLAPI .UpdateReverseEtlModel (r .authContext , state .ID .ValueString ()).UpdateReverseEtlModelInput (api.UpdateReverseEtlModelInput {
220214 Name : plan .Name .ValueStringPointer (),
221215 Description : plan .Description .ValueStringPointer (),
222216 Enabled : plan .Enabled .ValueBoolPointer (),
223- ScheduleStrategy : plan .ScheduleStrategy .ValueStringPointer (),
224- ScheduleConfig : scheduleConfig ,
225217 Query : plan .Query .ValueStringPointer (),
226218 QueryIdentifierColumn : plan .QueryIdentifierColumn .ValueStringPointer (),
227219 }).Execute ()
@@ -252,6 +244,10 @@ func (r *reverseETLModelResource) Update(ctx context.Context, req resource.Updat
252244 if resp .Diagnostics .HasError () {
253245 return
254246 }
247+
248+ // Since we deprecated these values, we just need to set them to the plan values so there are no errors
249+ resp .State .SetAttribute (ctx , path .Root ("schedule_config" ), plan .ScheduleConfig )
250+ resp .State .SetAttribute (ctx , path .Root ("schedule_strategy" ), plan .ScheduleStrategy )
255251}
256252
257253func (r * reverseETLModelResource ) Delete (ctx context.Context , req resource.DeleteRequest , resp * resource.DeleteResponse ) {
0 commit comments