title: aws serverless - exporting output value for cognito authorizer
body: <p>I'm trying to share cognito authorizer between my stacks for this I'm exporting my authorizer but when I try to reference it in another service I get the error </p>
  
  <p><strong>Trying to request a non exported variable from CloudFormation. Stack name: "myApp-services-test" Requested variable: "ExtApiGatewayAuthorizer-test".</strong></p>
  
  <p>Here is my stack where I have authorizer defined and exported: </p>
  
  <pre><code>    CognitoUserPool:
    Type: AWS::Cognito::UserPool
    Properties:
      # Generate a name based on the stage
      UserPoolName: ${self:provider.stage}-user-pool
      # Set email as an alias
      UsernameAttributes:
        - email
      AutoVerifiedAttributes:
        - email
  
      ApiGatewayAuthorizer: 
    Type: AWS::ApiGateway::Authorizer
    Properties: 
      Name: CognitoAuthorizer
      Type: COGNITO_USER_POOLS
      IdentitySource: method.request.header.Authorization
      RestApiId: { "Ref": "ProxyApi" }
      ProviderARNs: 
        - Fn::GetAtt:
            - CognitoUserPool
            - Arn
  
      ApiGatewayAuthorizerId:
    Value:
      Ref: ApiGatewayAuthorizer
    Export:
      Name: ExtApiGatewayAuthorizer-${self:provider.stage}
  </code></pre>
  
  <p>this is successfully exported as I can see it in stack exports list from my aws console.</p>
  
  <p>I try to reference it in another stack like this:</p>
  
  <pre><code>  myFunction:
  handler: handler.myFunction
  events:
    - http:
        path: /{userID}
        method: put
        cors: true
        authorizer:
          type: COGNITO_USER_POOLS
          authorizerId: ${myApp-services-${self:provider.stage}.ExtApiGatewayAuthorizer-${self:provider.stage}}
  </code></pre>
  
  <p>my env info</p>
  
  <pre><code>  Your Environment Information ---------------------------
   Operating System:          darwin
   Node Version:              12.13.1
   Framework Version:         1.60.5
   Plugin Version:            3.2.7
   SDK Version:               2.2.1
   Components Core Version:   1.1.2
   Components CLI Version:    1.4.0
  </code></pre>