Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix: Fixes 400 error in dataSourceUserPoolClientRead #38168

Merged
merged 4 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 error reading Cognito User Pool Client
```
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
Loading