I have the following resources in a SAM CloudFormation template (this template is not complete鈥攋ust showing the relevant parts):
Parameters:
EncryptedMongoUrl:
Type: "String"
Description: "Encrypted MONGO_URL value."
UserPoolName:
Type: "String"
Description: "Desired name of the Cognito user pool."
Resources:
UserPool:
Type: "AWS::Cognito::UserPool"
Properties:
UserPoolName: !Ref UserPoolName
Policies:
PasswordPolicy:
MinimumLength: 8
RequireLowercase: true
RequireUppercase: true
RequireNumbers: true
RequireSymbols: false
ApiGateway:
Type: "AWS::Serverless::Api"
DependsOn: UserPool
Properties:
StageName: "v1"
DefinitionUri: "./lambda-proxy-api.yaml"
Variables:
GraphQLFuncName: !Ref GraphQL
UserPoolArn: !GetAtt UserPool.Arn
Here's the lambda-proxy-api.yaml file:
---
swagger: 2.0
info:
title: OnSpotServerlessApi
paths:
"/graphql":
post:
responses: {}
security:
- UserPool: []
x-amazon-apigateway-integration:
uri: arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:xxx:function:${stageVariables.GraphQLFuncName}/invocations
httpMethod: POST
type: aws_proxy
securityDefinitions:
UserPool:
type: apiKey
name: Authorization
in: header
x-amazon-apigateway-authtype: cognito_user_pools
x-amazon-apigateway-authorizer:
providerARNs:
- ${stageVariables.UserPoolArn}
type: cognito_user_pools
Oddly enough, the GraphQL function name comes through just fine, but the stageVariables.UserPoolArn does not. When the stack tries to build, I get this error:
Errors found during import: Unable to create authorizer 'UserPool': ProviderARNs need to be valid Cognito Userpools. Invalid ARNs- ${stageVariables.UserPoolArn} Unable to put method 'POST' on resource at path '/graphql': Invalid authorizer ID specified. Setting the authorization type to CUSTOM or COGNITO_USER_POOLS requires a valid authorizer.
Why does this variable interpolation not work?
looks like #66 where we're told it's a problem on the apigw side.
Closing this because SAM can't do anything about it.