[SOLVED] - scroll down to last post for solution
I’m new to serverless and have a question about accessing resources in serverless.yml. I’ve been searching/googling for a few hours abut nothing works so far.
I have a User Pool created in a resource file: resources/cognito-user-pool.yml. Snippet:
CognitoUserPool: Type: AWS::Cognito::UserPool Properties: ...snipped... Outputs: UserPoolId: Value: Ref: CognitoUserPool
Then in the serverless.yml I’m trying to access the UserPoolId (or CognitoUserPool) to construct an arn to pass to an event authorizer:
events: - http: path: <path> method: get cors: true authorizer: arn: !Join ['', ['arn:aws:cognito-idp:',!Ref AWS::Region,':',!Ref AWS::AccountId,':userpool/',!Ref CognitoUserPool]]
Now I’ve played around quite a bit with trying to get this to work. It seems that I can’t run “!Join” code on the “arn:” line of an authorizer? Can I create a custom variable?
Can someone help provide some guidance as to how I can programmatically use the generated Cognito User Pool as the authorizer?
Thanks so much for any help