@@ -313,13 +313,13 @@ func readAuthConfig(ctx context.Context, state *SettingsResourceModel, client *a
313
313
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
314
314
}
315
315
// API treats sensitive fields as write-only
316
- var body api. AuthConfigResponse
316
+ var body LocalAuthConfig
317
317
if ! state .Auth .IsNull () {
318
318
if diags := state .Auth .Unmarshal (& body ); diags .HasError () {
319
319
return diags
320
320
}
321
321
}
322
- httpResp .JSON200 . SmtpPass = body . SmtpPass
322
+ body . overrideSensitiveFields ( httpResp .JSON200 )
323
323
if state .Auth , err = parseConfig (state .Auth , * httpResp .JSON200 ); err != nil {
324
324
msg := fmt .Sprintf ("Unable to read auth settings, got error: %s" , err )
325
325
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
@@ -343,7 +343,8 @@ func updateAuthConfig(ctx context.Context, plan *SettingsResourceModel, client *
343
343
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
344
344
}
345
345
// Copy over sensitive fields from TF plan
346
- httpResp .JSON200 .SmtpPass = body .SmtpPass
346
+ local := LocalAuthConfig {UpdateAuthConfigBody : body }
347
+ local .overrideSensitiveFields (httpResp .JSON200 )
347
348
348
349
if plan .Auth , err = parseConfig (plan .Auth , * httpResp .JSON200 ); err != nil {
349
350
msg := fmt .Sprintf ("Unable to update auth settings, got error: %s" , err )
@@ -439,6 +440,50 @@ func copyConfig(source any, target map[string]interface{}) {
439
440
}
440
441
}
441
442
443
+ type LocalAuthConfig struct {
444
+ api.UpdateAuthConfigBody
445
+ }
446
+
447
+ func (c LocalAuthConfig ) overrideSensitiveFields (resp * api.AuthConfigResponse ) {
448
+ // Email provider secrets
449
+ resp .SmtpPass = c .SmtpPass
450
+ // SMS provider secrets
451
+ resp .SmsTwilioAuthToken = c .SmsTwilioAuthToken
452
+ resp .SmsTwilioVerifyAuthToken = c .SmsTwilioVerifyAuthToken
453
+ resp .SmsMessagebirdAccessKey = c .SmsMessagebirdAccessKey
454
+ resp .SmsTextlocalApiKey = c .SmsTextlocalApiKey
455
+ resp .SmsVonageApiSecret = c .SmsVonageApiSecret
456
+ // Captcha provider secrets
457
+ resp .SecurityCaptchaSecret = c .SecurityCaptchaSecret
458
+ // External provider secrets
459
+ resp .ExternalAppleSecret = c .ExternalAppleSecret
460
+ resp .ExternalAzureSecret = c .ExternalAzureSecret
461
+ resp .ExternalBitbucketSecret = c .ExternalBitbucketSecret
462
+ resp .ExternalDiscordSecret = c .ExternalDiscordSecret
463
+ resp .ExternalFacebookSecret = c .ExternalFacebookSecret
464
+ resp .ExternalFigmaSecret = c .ExternalFigmaSecret
465
+ resp .ExternalGithubSecret = c .ExternalGithubSecret
466
+ resp .ExternalGitlabSecret = c .ExternalGitlabSecret
467
+ resp .ExternalGoogleSecret = c .ExternalGoogleSecret
468
+ resp .ExternalKakaoSecret = c .ExternalKakaoSecret
469
+ resp .ExternalKeycloakSecret = c .ExternalKeycloakSecret
470
+ resp .ExternalLinkedinOidcSecret = c .ExternalLinkedinOidcSecret
471
+ resp .ExternalNotionSecret = c .ExternalNotionSecret
472
+ resp .ExternalSlackOidcSecret = c .ExternalSlackOidcSecret
473
+ resp .ExternalSlackSecret = c .ExternalSlackSecret
474
+ resp .ExternalSpotifySecret = c .ExternalSpotifySecret
475
+ resp .ExternalTwitchSecret = c .ExternalTwitchSecret
476
+ resp .ExternalTwitterSecret = c .ExternalTwitterSecret
477
+ resp .ExternalWorkosSecret = c .ExternalWorkosSecret
478
+ resp .ExternalZoomSecret = c .ExternalZoomSecret
479
+ // Hook provider secrets
480
+ resp .HookCustomAccessTokenSecrets = c .HookCustomAccessTokenSecrets
481
+ resp .HookMfaVerificationAttemptSecrets = c .HookMfaVerificationAttemptSecrets
482
+ resp .HookPasswordVerificationAttemptSecrets = c .HookPasswordVerificationAttemptSecrets
483
+ resp .HookSendEmailSecrets = c .HookSendEmailSecrets
484
+ resp .HookSendSmsSecrets = c .HookSendSmsSecrets
485
+ }
486
+
442
487
type NetworkConfig struct {
443
488
Restrictions []string `json:"restrictions,omitempty"`
444
489
}
0 commit comments