Are you trying to get the cloudformation output of this service (i.e. the service of this serverless.yml file in which you are defining the environment variables)?
If so, I might have part of a solution with plugins, but for that you would have to be able to access output generated by a plugin from within serverless.yml. Unfortunately, I am not yet sure how to do that last part. I’ll see if I can figure this out.
Anyway, if you can somehow access plugin output from within
serverless.yml, then in your plugin you could do:
const awsInfo = serverless.pluginManager.plugins.find(p => p.constructor.name === 'AwsInfo')
const output = awsInfo.gatheredData.outputs
module.exports.output = output
Note that you would have to wait for the
after:aws:info:gatherData lifecycle event to have occured, otherwise the cloudformation output data will not yet be available. To simplify this, you can also install the serverless-scriptable-plugin and then define a script instead of a new plugin to gather the output as such:
# gather cloudformation output
And then (somehow) you would have to in your
Of course, the last step doesn’t work. Perhaps someone else here can enlighten us if this last step can be achieved?