Closed tommedema closed 7 years ago
I think you can do that using variables:
https://serverless.com/framework/docs/providers/aws/guide/variables/
@mvila I thought so too but failed to achieve the desired result
Ultimately I did it like so:
serverless.yml
custom:
scriptHooks:
after:aws:info:gatherData: scripts/compile-web.js
compile-web.js
/* global serverless */
console.log('compiling web package with cloudformation outputs')
const awsInfo = serverless.pluginManager.plugins.find(p => p.constructor.name === 'AwsInfo')
const getOutput = key => awsInfo.gatheredData.outputs.find(o => o.OutputKey === key).OutputValue
const gatewayUrl = getOutput('ServiceEndpoint')
console.log(gatewayUrl)
Note that this is using https://github.com/weixu365/serverless-scriptable-plugin
Seems rather hackish though.
I agree, it doesn't look very clean. I am sorry but I am afraid I cannot help you more on that. Actually, I stopped using Serverless Framework...
how would you inject the output of your cloudformation stack, e.g.
ServiceEndpoint
, to a build script for post processing? e.g. to dynamically inject the api endpoint into your frontend