Skip to content

Commit

Permalink
fix: more verbose logging
Browse files Browse the repository at this point in the history
  • Loading branch information
theBenForce committed Apr 23, 2020
1 parent 7639e32 commit 593fcfd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ export const templateTags = [
let credentials;

if (profile) {
console.info(`Loading profile "${profile}"`);
credentials = new AWS.SharedIniFileCredentials({ profile });
}

const cf = new AWS.CloudFormation({ region: region, credentials });

console.info(`Getting stack description for ${StackName}`);
const stackDescriptions = await cf
.describeStacks({
StackName,
Expand All @@ -52,6 +55,14 @@ export const templateTags = [
if (!stackDescriptions?.Stacks)
throw new Error(`Error getting data for stack ${StackName}`);

console.info(
`Got CF Data for stack ${StackName}: ${JSON.stringify(
stackDescriptions.Stacks,
null,
2
)}`
);

const resultOutput = stackDescriptions.Stacks.reduce(
(outputs: AWS.CloudFormation.Outputs, stack) =>
outputs.concat(stack.Outputs),
Expand All @@ -60,7 +71,11 @@ export const templateTags = [

if (!resultOutput?.OutputValue) {
throw new Error(
`Could not find output ${output} on stack ${StackName}`
`Could not find output ${output} on stack ${StackName}, results: ${JSON.stringify(
stackDescriptions.Stacks,
null,
2
)}`
);
}

Expand Down

0 comments on commit 593fcfd

Please sign in to comment.