Skip to content

Commit

Permalink
Added noDeploy to GetResourceArn #19
Browse files Browse the repository at this point in the history
  • Loading branch information
gmetzker committed Jan 23, 2017
1 parent c4d39a8 commit 7ecfb54
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ class Plugin {
throw new Error(`Function property ${functionName}.deadLetter.targetArn object is missing GetResourceArn property.`);
}

const stackName = this.provider.naming.getStackName();
if (!this.deploy) {
// If noDeploy options is set then there is no guarantee that the stack exists
// and no guarantee that the serverless.yml even matches the a previously deploy stack.
// So instead of returning the real arn we'll return a string that
// can be used for logging but not an actual ARN.
return BbPromise.resolve(`\${GetResourceArn: ${targetArn.GetResourceArn}}`);
}

// this.serverless.cli.log(`Stackname: ${stackName}`);
const stackName = this.provider.naming.getStackName();

const params = {
StackName: stackName,
Expand Down Expand Up @@ -160,7 +166,7 @@ class Plugin {
return updateStep.then(() => {

this.serverless.cli.log(`${logPrefix} Function '${functionName}' ` +
`DeadLetterConfig.TargetArn: '${arnStr}'`);
`DeadLetterConfig.TargetArn: ${arnStr}`);
});

}));
Expand Down

0 comments on commit 7ecfb54

Please sign in to comment.