@@ -144,6 +144,7 @@ func (r *PageResource) Create(ctx context.Context, req resource.CreateRequest, r
144144func (r * PageResource ) Update (ctx context.Context , req resource.UpdateRequest , resp * resource.UpdateResponse ) {
145145 var state * PageModel
146146 var p * cli.Page
147+ var updatedPage * cli.Page
147148
148149 resp .Diagnostics .Append (req .Plan .Get (ctx , & state )... )
149150
@@ -164,18 +165,23 @@ func (r *PageResource) Update(ctx context.Context, req resource.UpdateRequest, r
164165 }
165166
166167 p , err = r .portClient .UpdatePage (ctx , page .Identifier , page )
167-
168168 if err != nil {
169169 resp .Diagnostics .AddError ("failed to update page" , err .Error ())
170170 return
171171 }
172172
173+ updatedPage , _ , err = r .portClient .GetPage (ctx , state .Identifier .ValueString ())
174+ if err != nil {
175+ resp .Diagnostics .AddError ("failed to get updated page" , err .Error ())
176+ return
177+ }
178+
173179 state .ID = types .StringValue (p .Identifier )
174- state .CreatedAt = types .StringValue (p .CreatedAt .String ())
175- state .CreatedBy = types .StringValue (p .CreatedBy )
176- state .UpdatedAt = types .StringValue (p .UpdatedAt .String ())
177- state .UpdatedBy = types .StringValue (p .UpdatedBy )
178- state .Description = types .StringPointerValue (p .Description )
180+ state .CreatedAt = types .StringValue (updatedPage .CreatedAt .String ())
181+ state .CreatedBy = types .StringValue (updatedPage .CreatedBy )
182+ state .UpdatedAt = types .StringValue (updatedPage .UpdatedAt .String ())
183+ state .UpdatedBy = types .StringValue (updatedPage .UpdatedBy )
184+ state .Description = types .StringPointerValue (updatedPage .Description )
179185
180186 resp .Diagnostics .Append (resp .State .Set (ctx , & state )... )
181187
0 commit comments