@@ -153,7 +153,13 @@ func (r *OrganizationResource) Create(ctx context.Context, req resource.CreateRe
153153 return
154154 }
155155
156- tflog .Trace (ctx , "creating organization" )
156+ tflog .Trace (ctx , "creating organization" , map [string ]any {
157+ "id" : data .ID .ValueUUID (),
158+ "name" : data .Name .ValueString (),
159+ "display_name" : data .DisplayName .ValueString (),
160+ "description" : data .Description .ValueString (),
161+ "icon" : data .Icon .ValueString (),
162+ })
157163 org , err := r .Client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
158164 Name : data .Name .ValueString (),
159165 DisplayName : data .DisplayName .ValueString (),
@@ -165,7 +171,11 @@ func (r *OrganizationResource) Create(ctx context.Context, req resource.CreateRe
165171 return
166172 }
167173 tflog .Trace (ctx , "successfully created organization" , map [string ]any {
168- "id" : org .ID ,
174+ "id" : org .ID ,
175+ "name" : org .Name ,
176+ "display_name" : org .DisplayName ,
177+ "description" : org .Description ,
178+ "icon" : org .Icon ,
169179 })
170180 // Fill in `ID` since it must be "computed".
171181 data .ID = UUIDValue (org .ID )
@@ -190,12 +200,12 @@ func (r *OrganizationResource) Update(ctx context.Context, req resource.UpdateRe
190200 // Update the organization metadata
191201 tflog .Trace (ctx , "updating organization" , map [string ]any {
192202 "id" : orgID ,
193- "new_name" : data .Name ,
194- "new_display_name" : data .DisplayName ,
195- "new_description" : data .Description ,
196- "new_icon" : data .Icon ,
203+ "new_name" : data .Name . ValueString () ,
204+ "new_display_name" : data .DisplayName . ValueString () ,
205+ "new_description" : data .Description . ValueString () ,
206+ "new_icon" : data .Icon . ValueString () ,
197207 })
198- _ , err := r .Client .UpdateOrganization (ctx , orgID .String (), codersdk.UpdateOrganizationRequest {
208+ org , err := r .Client .UpdateOrganization (ctx , orgID .String (), codersdk.UpdateOrganizationRequest {
199209 Name : data .Name .ValueString (),
200210 DisplayName : data .DisplayName .ValueString (),
201211 Description : data .Description .ValueStringPointer (),
@@ -205,7 +215,13 @@ func (r *OrganizationResource) Update(ctx context.Context, req resource.UpdateRe
205215 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to update organization %s, got error: %s" , orgID , err ))
206216 return
207217 }
208- tflog .Trace (ctx , "successfully updated organization" )
218+ tflog .Trace (ctx , "successfully updated organization" , map [string ]any {
219+ "id" : orgID ,
220+ "name" : org .Name ,
221+ "display_name" : org .DisplayName ,
222+ "description" : org .Description ,
223+ "icon" : org .Icon ,
224+ })
209225
210226 // Save updated data into Terraform state
211227 resp .Diagnostics .Append (resp .State .Set (ctx , & data )... )
@@ -222,14 +238,18 @@ func (r *OrganizationResource) Delete(ctx context.Context, req resource.DeleteRe
222238 orgID := data .ID .ValueUUID ()
223239
224240 tflog .Trace (ctx , "deleting organization" , map [string ]any {
225- "id" : orgID ,
241+ "id" : orgID ,
242+ "name" : data .Name .ValueString (),
226243 })
227244 err := r .Client .DeleteOrganization (ctx , orgID .String ())
228245 if err != nil {
229246 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to delete organization %s, got error: %s" , orgID , err ))
230247 return
231248 }
232- tflog .Trace (ctx , "successfully deleted organization" )
249+ tflog .Trace (ctx , "successfully deleted organization" , map [string ]any {
250+ "id" : orgID ,
251+ "name" : data .Name .ValueString (),
252+ })
233253
234254 // Read Terraform prior state data into the model
235255 resp .Diagnostics .Append (req .State .Get (ctx , & data )... )
0 commit comments