@@ -153,7 +153,13 @@ func (r *OrganizationResource) Create(ctx context.Context, req resource.CreateRe
153
153
return
154
154
}
155
155
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
+ })
157
163
org , err := r .Client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
158
164
Name : data .Name .ValueString (),
159
165
DisplayName : data .DisplayName .ValueString (),
@@ -165,7 +171,11 @@ func (r *OrganizationResource) Create(ctx context.Context, req resource.CreateRe
165
171
return
166
172
}
167
173
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 ,
169
179
})
170
180
// Fill in `ID` since it must be "computed".
171
181
data .ID = UUIDValue (org .ID )
@@ -190,12 +200,12 @@ func (r *OrganizationResource) Update(ctx context.Context, req resource.UpdateRe
190
200
// Update the organization metadata
191
201
tflog .Trace (ctx , "updating organization" , map [string ]any {
192
202
"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 () ,
197
207
})
198
- _ , err := r .Client .UpdateOrganization (ctx , orgID .String (), codersdk.UpdateOrganizationRequest {
208
+ org , err := r .Client .UpdateOrganization (ctx , orgID .String (), codersdk.UpdateOrganizationRequest {
199
209
Name : data .Name .ValueString (),
200
210
DisplayName : data .DisplayName .ValueString (),
201
211
Description : data .Description .ValueStringPointer (),
@@ -205,7 +215,13 @@ func (r *OrganizationResource) Update(ctx context.Context, req resource.UpdateRe
205
215
resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to update organization %s, got error: %s" , orgID , err ))
206
216
return
207
217
}
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
+ })
209
225
210
226
// Save updated data into Terraform state
211
227
resp .Diagnostics .Append (resp .State .Set (ctx , & data )... )
@@ -222,14 +238,18 @@ func (r *OrganizationResource) Delete(ctx context.Context, req resource.DeleteRe
222
238
orgID := data .ID .ValueUUID ()
223
239
224
240
tflog .Trace (ctx , "deleting organization" , map [string ]any {
225
- "id" : orgID ,
241
+ "id" : orgID ,
242
+ "name" : data .Name .ValueString (),
226
243
})
227
244
err := r .Client .DeleteOrganization (ctx , orgID .String ())
228
245
if err != nil {
229
246
resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to delete organization %s, got error: %s" , orgID , err ))
230
247
return
231
248
}
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
+ })
233
253
234
254
// Read Terraform prior state data into the model
235
255
resp .Diagnostics .Append (req .State .Get (ctx , & data )... )
0 commit comments