Serverless: Use serverless-{service-name}-{stage}-ServiceEndpoint as default CF export name for ServiceEndput

Created on 12 May 2017  ·  3Comments  ·  Source: serverless/serverless

Currently ServiceEndpoint and ImportEventLambdaFunctionQualifiedArn from CF stack are Output variables, but it would be nice to have default Export Name for them, something like sls-{service-name}-{stage}-ServiceEndpoint.

It would allow to auto-use outputs from the stack in other CF scripts by default.

We currently can do the same functionality in the custom resource section where we can introduce an output variable with export name but it would be cool to have this available by default for core output variables.


Proposed solution

_(added by maintainers)_

For each configured output in scope of the Framework, configure an export name with following naming rules:

sls-{service}-{stage}-{outputName}

I think it's unique enough to not be considered as breaking change, still if you feel it can be risky to just introduce that please elaborate.

cadeployment enhancement good first issue help wanted

Most helpful comment

Just want to clarify on what to add to the custom resource section in serverless.yml, since I was looking for it myself:
```resources:
Outputs:
ServiceEndpointExport:
Description: Exported Url of the endpoint
Value:
Fn::Join:
- ""
- - "https://"
- "Ref": "ApiGatewayRestApi"
- ".execute-api.eu-west-1.amazonaws.com/dev"
Export:
Name: "${self:provider.stage}:${self:service}:ServiceEndpoint"

All 3 comments

That would be very useful, even better if it could export a few extra details (e.g. the API ID)

Just want to clarify on what to add to the custom resource section in serverless.yml, since I was looking for it myself:
```resources:
Outputs:
ServiceEndpointExport:
Description: Exported Url of the endpoint
Value:
Fn::Join:
- ""
- - "https://"
- "Ref": "ApiGatewayRestApi"
- ".execute-api.eu-west-1.amazonaws.com/dev"
Export:
Name: "${self:provider.stage}:${self:service}:ServiceEndpoint"

I've updated main description with implementation proposal. PR's welcome!

Was this page helpful?
0 / 5 - 0 ratings