I have not been able to get Resources/Outputs/Exports to work in an effort to use multiple serverless configs that build out micro services to a single api gateway. According to this issue/discussion this should now work.
i’m sure its my config, but I have tried the documented way from this link… I am getting the error The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template
I would be deeply grateful for any advice… thank you. This is the config I am using:
service: api-model
frameworkVersion: '^1.33.0'
provider:
name: aws
runtime: nodejs8.10
apiName: myapp-api-${opt:stage,'dev'}
Resources:
Outputs:
apiGatewayRestApiId:
Value:
Ref: ApiGatewayRestApi
Export:
Name: apiGateway-restApiId
apiGatewayRestApiRootResourceId:
Value:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
Export:
Name: apiGateway-rootResourceId
apiGateway:
restApiId:
Ref: ApiGatewayRestApi
restApiResources:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
functions:
api-model-read:
environment:
DEBUG: 'false'
events:
- http:
path: /data/model
method: get
- http:
path: /data/model/{modelId}
method: get
request:
parameters:
paths:
modelId: true
handler: read.handler
memorySize: 128
name: api-${opt:stage, 'dev'}-model-read
timeout: 30