Skip to content

aws-appsync: imported resources from other regions using the current stack region #20195

Closed
@ryanvaloris

Description

@ryanvaloris

Describe the bug

When trying to import a Cognito UserPool to be used in an AppSync Graphql domain, the UserPool is configured with the region of the stack that is being deployed and disregards the region supplied in the ARN.

Expected Behavior

Using the construct below and assuming that this.stack is created in us-west-2:

return new GraphqlApi(this.stack, `api`, {
      name: `TheAPI`,
      schema: Schema.fromAsset('schema.graphql'),
      authorizationConfig: {
        defaultAuthorization: {
          authorizationType: AuthorizationType.USER_POOL,
          userPoolConfig: {
            userPool: UserPool.fromUserPoolArn(this.stack, 'CognitoUserPool', `arn:aws:cognito-idp:us-east-1:${this.awsAccountId}:userpool/${userPoolId}`),
            defaultAction: UserPoolDefaultAction.ALLOW
          }
        }
      },
      logConfig: {
        excludeVerboseContent: false,
        fieldLogLevel: FieldLogLevel.ALL
      },
      xrayEnabled: true
    });

I expected the UserPool to be linked to the UserPool created in us-east-1 per the ARN provided.

  "TheApi": {
   "Type": "AWS::AppSync::GraphQLApi",
   "Properties": {
    "AuthenticationType": "AMAZON_COGNITO_USER_POOLS",
    "Name": "TheApi",
    "UserPoolConfig": {
     "AwsRegion": "us-east-1",
     "DefaultAction": "ALLOW",
     "UserPoolId": {
      "Ref": "SomeId"
     }
     ...
  }

Current Behavior

However, the generated output shows us-west-2 as the region:

  "TheApi": {
   "Type": "AWS::AppSync::GraphQLApi",
   "Properties": {
    "AuthenticationType": "AMAZON_COGNITO_USER_POOLS",
    "Name": "TheApi",
    "UserPoolConfig": {
     "AwsRegion": "us-west-2",
     "DefaultAction": "ALLOW",
     "UserPoolId": {
      "Ref": "SomeId"
     }
     ...
  }

Reproduction Steps

build a new graphQl API with a UserPool from a different region

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

1.152.0

Framework Version

No response

Node.js Version

v16.10.0

OS

MacOS Monterey 12.3

Language

Typescript

Language Version

No response

Other information

No response

Activity

added
bugThis issue is a bug.
needs-triageThis issue or PR still needs to be triaged.
on May 3, 2022
added and removed
needs-triageThis issue or PR still needs to be triaged.
on May 3, 2022
ryanvaloris

ryanvaloris commented on May 3, 2022

@ryanvaloris
Author

related #13691

added a commit that references this issue on May 5, 2022
3e0393e
github-actions

github-actions commented on May 5, 2022

@github-actions
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

added a commit that references this issue on May 23, 2022
796e1ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @otaviomacedo@RomainMuller@ryanvaloris

    Issue actions

      aws-appsync: imported resources from other regions using the current stack region · Issue #20195 · aws/aws-cdk