@@ -312,6 +312,14 @@ func readAuthConfig(ctx context.Context, state *SettingsResourceModel, client *a
312
312
msg := fmt .Sprintf ("Unable to read auth settings, got status %d: %s" , httpResp .StatusCode (), httpResp .Body )
313
313
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
314
314
}
315
+ // API treats sensitive fields as write-only
316
+ var body api.AuthConfigResponse
317
+ if ! state .Auth .IsNull () {
318
+ if diags := state .Auth .Unmarshal (& body ); diags .HasError () {
319
+ return diags
320
+ }
321
+ }
322
+ httpResp .JSON200 .SmtpPass = body .SmtpPass
315
323
if state .Auth , err = parseConfig (state .Auth , * httpResp .JSON200 ); err != nil {
316
324
msg := fmt .Sprintf ("Unable to read auth settings, got error: %s" , err )
317
325
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
@@ -334,6 +342,8 @@ func updateAuthConfig(ctx context.Context, plan *SettingsResourceModel, client *
334
342
msg := fmt .Sprintf ("Unable to update auth settings, got status %d: %s" , httpResp .StatusCode (), httpResp .Body )
335
343
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
336
344
}
345
+ // Copy over sensitive fields from TF plan
346
+ httpResp .JSON200 .SmtpPass = body .SmtpPass
337
347
338
348
if plan .Auth , err = parseConfig (plan .Auth , * httpResp .JSON200 ); err != nil {
339
349
msg := fmt .Sprintf ("Unable to update auth settings, got error: %s" , err )
0 commit comments