diff --git a/CHANGELOG.md b/CHANGELOG.md index e5896b4b..89de352b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Canonical reference for changes, improvements, and bugfixes for the Boundary Terraform provider. +## 1.1.7 (May 12, 2023) + +### Bug Fix +* Fix default auth method with recovery kms + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/405)) + ## 1.1.6 (May 5, 2023) ### New and Improved diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 69faef1d..313d7e3e 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -140,10 +140,11 @@ 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 { - defaultAuthMethodId, err := getDefaultAuthMethodId(ctx, amClient, providerScope, PASSWORD_AUTH_METHOD_PREFIX) + if !authMethodIdOk && !recoveryKmsHclOk && md.client.Token() == "" { + defaultAuthMethodId, err := getDefaultAuthMethodId(ctx, amClient, providerScope, "") if err != nil { return err } diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 0791ed40..e1abb92b 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -13,6 +13,7 @@ import ( "testing" "github.com/hashicorp/boundary/testing/controller" + "github.com/hashicorp/cap/oidc" wrapping "github.com/hashicorp/go-kms-wrapping/v2" "github.com/hashicorp/go-kms-wrapping/v2/aead" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -140,9 +141,6 @@ func testConfigWithRecovery(url string, res ...string) string { provider := fmt.Sprintf(` provider "boundary" { addr = "%s" - auth_method_id = "%s" - password_auth_method_login_name = "%s" - password_auth_method_password = "%s" recovery_kms_hcl = <