mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
mergeMerge branch 'HyperBrain-make-cf-outputs-accessible-as-variables' into v0.5
This commit is contained in:
commit
5ef031a58e
@ -35,6 +35,7 @@ class ServerlessProject {
|
||||
_this.components = {};
|
||||
_this.templates = {};
|
||||
_this.plugins = [];
|
||||
_this.resourceVars = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -12,6 +12,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
SError = require(path.join(serverlessPath, 'ServerlessError')),
|
||||
SCli = require(path.join(serverlessPath, 'utils/cli')),
|
||||
BbPromise = require('bluebird'),
|
||||
_ = require('lodash'),
|
||||
SUtils = require(path.join(serverlessPath, 'utils/index'));
|
||||
|
||||
class ResourcesDeploy extends SPlugin {
|
||||
@ -155,6 +156,7 @@ usage: serverless resources deploy`,
|
||||
|
||||
let _this = this;
|
||||
let regionVars = _this.S.state.getMeta().stages[_this.evt.options.stage].regions[_this.evt.options.region].variables;
|
||||
let resourceVars = [ 'iamRoleArnLambda' ].concat( _this.S.state.getProject().resourceVars);
|
||||
|
||||
return _this.S.state.getResources({
|
||||
populate: true,
|
||||
@ -241,11 +243,12 @@ usage: serverless resources deploy`,
|
||||
// Save stack name
|
||||
regionVars.resourcesStackName = cfStackData.StackName;
|
||||
|
||||
// Save IAM Role ARN for Project Lambdas
|
||||
// Save allowed (exported) CF output variables for Project Lambdas
|
||||
for (let i = 0; i < cfStackData.Outputs.length; i++) {
|
||||
if (cfStackData.Outputs[i].OutputKey === 'IamRoleArnLambda') {
|
||||
regionVars.iamRoleArnLambda = cfStackData.Outputs[i].OutputValue;
|
||||
}
|
||||
let varName = _.lowerFirst(cfStackData.Outputs[i].OutputKey);
|
||||
if (resourceVars.indexOf(varName) !== -1) {
|
||||
regionVars[varName] = cfStackData.Outputs[i].OutputValue;
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user