# Cross Stack reference to api gateway?

**URL:** <https://forum.serverless.com/t/cross-stack-reference-to-api-gateway/3842>\
**Category:** Serverless Framework\
**Created:** [February 23, 2018, 2:38am UTC](https://forum.serverless.com/t/cross-stack-reference-to-api-gateway/3842 "2018-02-23T02:38:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralucas](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@ralucas](https://forum.serverless.com/u/ralucas)\
**Post date:** [February 23, 2018, 2:38am UTC](https://forum.serverless.com/t/cross-stack-reference-to-api-gateway/3842/1 "2018-02-23T02:38:53Z")

</div>

I’ve created an api gateway:

```
  Resources: 
    ApiGateway:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: ${self:service}_${self:provider.stage}
      Description: ${self:custom.defaults.description}
  Outputs:
    ApiGatewayRestApi:
    Description: 'Api Gateway Rest Api'
    Value:
      Ref: ApiGateway
    Export:
       Name: 'ApiGateway:${self:provider.stage}:RestApiID'

```

And then try to import it in a microservice i.e:

```
provider: 
  apiGateway:
     restApiId: 
         Ref: ${cf:stackname-${self:provider.stage}.ApiGatewayRestApi}

```

I got the error:

```
 The CloudFormation template is invalid: Template format error: 
 Unresolved resource dependencies [actual_api_gateway_rest_id] 
 in the Resources block of the template

```

Any ideas what I’m doing wrong?
