Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions internal/provider/settings_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@ func readAuthConfig(ctx context.Context, state *SettingsResourceModel, client *a
msg := fmt.Sprintf("Unable to read auth settings, got status %d: %s", httpResp.StatusCode(), httpResp.Body)
return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)}
}
// API treats sensitive fields as write-only
var body api.AuthConfigResponse
if !state.Auth.IsNull() {
if diags := state.Auth.Unmarshal(&body); diags.HasError() {
return diags
}
}
httpResp.JSON200.SmtpPass = body.SmtpPass
if state.Auth, err = parseConfig(state.Auth, *httpResp.JSON200); err != nil {
msg := fmt.Sprintf("Unable to read auth settings, got error: %s", err)
return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)}
Expand All @@ -334,6 +342,8 @@ func updateAuthConfig(ctx context.Context, plan *SettingsResourceModel, client *
msg := fmt.Sprintf("Unable to update auth settings, got status %d: %s", httpResp.StatusCode(), httpResp.Body)
return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)}
}
// Copy over sensitive fields from TF plan
httpResp.JSON200.SmtpPass = body.SmtpPass

if plan.Auth, err = parseConfig(plan.Auth, *httpResp.JSON200); err != nil {
msg := fmt.Sprintf("Unable to update auth settings, got error: %s", err)
Expand Down
Loading