Skip to content

Commit

Permalink
Merge pull request #38168 from t-oki/main
Browse files Browse the repository at this point in the history
BugFix: Fixes 400 error in dataSourceUserPoolClientRead
  • Loading branch information
ewbankkit authored Jun 28, 2024
2 parents d3de425 + 57ac819 commit 5b43711
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/38168.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
data-source/aws_cognito_user_pool_client: Fix `InvalidParameterException: 2 validation errors detected` errors on Read
```
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func dataSourceUserPoolClientRead(ctx context.Context, d *schema.ResourceData, m
conn := meta.(*conns.AWSClient).CognitoIDPClient(ctx)

clientID := d.Get(names.AttrClientID).(string)
userPoolClient, err := findUserPoolClientByTwoPartKey(ctx, conn, d.Get(names.AttrUserPoolID).(string), d.Id())
userPoolClient, err := findUserPoolClientByTwoPartKey(ctx, conn, d.Get(names.AttrUserPoolID).(string), clientID)

if err != nil {
return sdkdiag.AppendErrorf(diags, "reading Cognito User Pool Client (%s): %s", clientID, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package cognitoidp_test
import (
"testing"

awstypes "github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider/types"
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
Expand All @@ -14,6 +15,7 @@ import (

func TestAccCognitoIDPUserPoolClientDataSource_basic(t *testing.T) {
ctx := acctest.Context(t)
var client awstypes.UserPoolClientType
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
resourceName := "data.aws_cognito_user_pool_client.test"

Expand All @@ -25,6 +27,7 @@ func TestAccCognitoIDPUserPoolClientDataSource_basic(t *testing.T) {
{
Config: testAccUserPoolClientDataSourceConfig_basic(rName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckUserPoolClientExists(ctx, resourceName, &client),
resource.TestCheckResourceAttr(resourceName, names.AttrName, rName),
resource.TestCheckResourceAttr(resourceName, "explicit_auth_flows.#", acctest.Ct1),
resource.TestCheckTypeSetElemAttr(resourceName, "explicit_auth_flows.*", "ADMIN_NO_SRP_AUTH"),
Expand Down

0 comments on commit 5b43711

Please sign in to comment.