Skip to content

Commit

Permalink
fix: return output value
Browse files Browse the repository at this point in the history
  • Loading branch information
theBenForce committed Apr 23, 2020
1 parent 9032716 commit d8e169f
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@ export const templateTags = [
})
.promise();

console.info(
`cfoutput found the following information: ${JSON.stringify(
stackDescriptions.Stacks
)}`
);
return "Test Value";
if (!stackDescriptions?.Stacks)
throw new Error(`Error getting data for stack ${StackName}`);

const resultOutput = stackDescriptions.Stacks.reduce(
(outputs: AWS.CloudFormation.Outputs, stack) =>
outputs.concat(stack.Outputs),
[]
).find((output) => output.OutputKey === output);

if (!resultOutput?.OutputValue) {
throw new Error(
`Could not find output ${output} on stack ${StackName}`
);
}

return resultOutput.OutputValue;
},
},
] as Array<Insomnia.TemplateTag>;

0 comments on commit d8e169f

Please sign in to comment.