From f3cc700d0e947cbb2c7de8d294eeb5a34b208cd1 Mon Sep 17 00:00:00 2001 From: Ben Force Date: Thu, 23 Apr 2020 07:23:11 -0500 Subject: [PATCH] feat: allow a specific profile to be used --- src/index.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index f8cc2e3..cfbde47 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,9 +22,26 @@ export const templateTags = [ type: "string", defaultValue: "us-east-1", }, + { + displayName: "Profile", + description: "Name of the AWS CLI Profile to use", + type: "string", + }, ], - async run(context, StackName, output, region): Promise { - const cf = new AWS.CloudFormation({ region: region }); + async run( + context, + StackName: string, + output: string, + region: string, + profile: string + ): Promise { + let credentials; + + if (profile) { + credentials = new AWS.SharedIniFileCredentials({ profile }); + } + + const cf = new AWS.CloudFormation({ region: region, credentials }); const stackDescriptions = await cf .describeStacks({ StackName,