fix: default auth method with recovery kms (#406)

* add test coverage for authenticating with recovery kms mechanism & oidc primary auth method

* Skip fetching default auth method when recovery_kms_hcl is set or the client token isn't null
This commit is contained in:
Elim Tsiagbey authored and GitHub committed 2023-05-12 10:56:58 -04:00
1 parent e7ed748b76
commit 83826aa866
3 files changed
+56 -8

No files matched your search

+3 -2
View File
@@ -156,9 +156,10 @@ func providerAuthenticate(ctx context.Context, d *schema.ResourceData, md *metaD
md.client.SetToken(token.(string))
}
// If auth_method_id is not set, get the default auth method ID for the given scope ID
// If auth_method_id is not set, get the default auth method ID for the given scope ID.
// Skip fetching default auth method when recovery_kms_hcl is set or the client token isn't null.
authMethodId, authMethodIdOk := d.GetOk("auth_method_id")
if !authMethodIdOk {
if !authMethodIdOk && !recoveryKmsHclOk && md.client.Token() == "" {
defaultAuthMethodId, err := getDefaultAuthMethodId(ctx, amClient, providerScope, "")
if err != nil {
return err