Hi!
I’m trying to refactor my mono-service Stack to a multi-services Cross-Stack. First I have my ApiGatway created with this route:
functions:
contact-creation:
handler: handler.creation
environment:
USER_POOL:
Ref: ${self:custom.stage}-ContactsCognitoUserPoolId
events:
- http:
method: post
path: contact
cors:
origins: ${self:custom.cors.${self:custom.stage}
In this route, USER_POOL is needed to update the cognito profile of the user.
In my deployment process, I need to create the ApiGateway before the Cognito user pool and identity pool because I specify the access in the identity pool like this:
- Effect: 'Allow'
Action:
- 'execute-api:Invoke'
Resource:
Fn::Join:
- ''
-
- 'arn:aws:execute-api:'
- Ref: AWS::Region
- ':'
- Ref: AWS::AccountId
- ':'
- 'Fn::ImportValue': ${self:custom.stage}-ApiGatewayRestApiId
- '/*'
When I trigger the deployment, I get this error:
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [dev-ContactsCognitoUserPoolId] in the Resources block of the template
Do I need to import the ressources in my ApiGateway service or I can stay with the Cognito completely separated from others services? How can I handle this correctly?
Thank you for your help!