From dfaea8e259e9b040f48f2af2193df5fce0c9a7c1 Mon Sep 17 00:00:00 2001 From: Louis Ruch Date: Fri, 13 May 2022 15:17:40 -0700 Subject: [PATCH] fix(account): Update account deprecations resource_account has been depreacted in favor of resource_account_password instead of deprecating the individual password based fields. --- internal/provider/resource_account.go | 9 ++------- internal/provider/resource_account_password.go | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/internal/provider/resource_account.go b/internal/provider/resource_account.go index 138ca562..2a44f6b6 100644 --- a/internal/provider/resource_account.go +++ b/internal/provider/resource_account.go @@ -12,7 +12,8 @@ import ( func resourceAccount() *schema.Resource { return &schema.Resource{ - Description: "The account resource allows you to configure a Boundary account.", + DeprecationMessage: "Deprecated: use `resource_account_password` instead.", + Description: "Deprecated: use `resource_account_password` instead.", CreateContext: resourceAccountCreate, ReadContext: resourceAccountRead, @@ -54,13 +55,11 @@ func resourceAccount() *schema.Resource { Description: "The login name for this account.", Type: schema.TypeString, Optional: true, - Deprecated: "Will be removed in favor of using attributes parameter", }, accountPasswordKey: { Description: "The account password. Only set on create, changes will not be reflected when updating account.", Type: schema.TypeString, Optional: true, - Deprecated: "Will be removed in favor of using attributes parameter", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { if d.Id() == "" { @@ -88,7 +87,6 @@ func setFromAccountResponseMap(d *schema.ResourceData, raw map[string]interface{ return err } - // TODO(malnick) - remove after deprecation cycle in favor of attributes switch raw["type"].(string) { case accountTypePassword: if attrsVal, ok := raw["attributes"]; ok { @@ -123,12 +121,10 @@ func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, meta int opts = append(opts, accounts.WithDescription(descVal.(string))) } - // TODO(malnick) - remove after deprecation cycle if name, ok := d.GetOk(accountLoginNameKey); ok { opts = append(opts, accounts.WithPasswordAccountLoginName(name.(string))) } - // TODO(malnick) - remove after deprecation cycle if pass, ok := d.GetOk(accountPasswordKey); ok { opts = append(opts, accounts.WithPasswordAccountPassword(pass.(string))) } @@ -195,7 +191,6 @@ func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, meta int } } - // TODO(malnick) - remove after deprecation cycle if d.HasChange(accountLoginNameKey) { opts = append(opts, accounts.DefaultPasswordAccountLoginName()) if keyVal, ok := d.GetOk(accountLoginNameKey); ok { diff --git a/internal/provider/resource_account_password.go b/internal/provider/resource_account_password.go index a20bba74..10c5cdbe 100644 --- a/internal/provider/resource_account_password.go +++ b/internal/provider/resource_account_password.go @@ -60,13 +60,11 @@ func resourceAccountPassword() *schema.Resource { Description: "The login name for this account.", Type: schema.TypeString, Optional: true, - Deprecated: "Will be removed in favor of using attributes parameter", }, accountPasswordKey: { Description: "The account password. Only set on create, changes will not be reflected when updating account.", Type: schema.TypeString, Optional: true, - Deprecated: "Will be removed in favor of using attributes parameter", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { if d.Id() == "" {