@@ -56,6 +56,7 @@ async function parseCommandLineArguments() {
56
56
. option ( 'proxy' , { type : 'string' , desc : 'Use the indicated proxy. Will read from HTTPS_PROXY environment variable if not specified.' } )
57
57
. option ( 'ec2creds' , { type : 'boolean' , alias : 'i' , default : undefined , desc : 'Force trying to fetch EC2 instance credentials. Default: guess EC2 instance status.' } )
58
58
. option ( 'version-reporting' , { type : 'boolean' , desc : 'Disable insersion of the CDKMetadata resource in synthesized templates' , default : undefined } )
59
+ . option ( 'role-arn' , { type : 'string' , alias : 'r' , desc : 'ARN of Role to use when invoking CloudFormation' , default : undefined } )
59
60
. command ( [ 'list' , 'ls' ] , 'Lists all stacks in the app' , yargs => yargs
60
61
. option ( 'long' , { type : 'boolean' , default : false , alias : 'l' , desc : 'display environment information for each stack' } ) )
61
62
. command ( [ 'synthesize [STACKS..]' , 'synth [STACKS..]' ] , 'Synthesizes and prints the CloudFormation template for this stack' , yargs => yargs
@@ -188,13 +189,13 @@ async function initCommandLine() {
188
189
return await diffStack ( await findStack ( args . STACK ) , args . template ) ;
189
190
190
191
case 'bootstrap' :
191
- return await cliBootstrap ( args . ENVIRONMENTS , toolkitStackName ) ;
192
+ return await cliBootstrap ( args . ENVIRONMENTS , toolkitStackName , args . roleArn ) ;
192
193
193
194
case 'deploy' :
194
- return await cliDeploy ( args . STACKS , toolkitStackName ) ;
195
+ return await cliDeploy ( args . STACKS , toolkitStackName , args . roleArn ) ;
195
196
196
197
case 'destroy' :
197
- return await cliDestroy ( args . STACKS , args . force ) ;
198
+ return await cliDestroy ( args . STACKS , args . force , args . roleArn ) ;
198
199
199
200
case 'synthesize' :
200
201
case 'synth' :
@@ -266,7 +267,7 @@ async function initCommandLine() {
266
267
* all stacks are implicitly selected.
267
268
* @param toolkitStackName the name to be used for the CDK Toolkit stack.
268
269
*/
269
- async function cliBootstrap ( environmentGlobs : string [ ] , toolkitStackName : string ) : Promise < void > {
270
+ async function cliBootstrap ( environmentGlobs : string [ ] , toolkitStackName : string , roleArn : string | undefined ) : Promise < void > {
270
271
if ( environmentGlobs . length === 0 ) {
271
272
environmentGlobs = [ '**' ] ; // default to ALL
272
273
}
@@ -282,7 +283,7 @@ async function initCommandLine() {
282
283
await Promise . all ( environments . map ( async ( environment ) => {
283
284
success ( ' ⏳ Bootstrapping environment %s...' , colors . blue ( environment . name ) ) ;
284
285
try {
285
- const result = await bootstrapEnvironment ( environment , aws , toolkitStackName ) ;
286
+ const result = await bootstrapEnvironment ( environment , aws , toolkitStackName , roleArn ) ;
286
287
const message = result . noOp ? ' ✅ Environment %s was already fully bootstrapped!'
287
288
: ' ✅ Successfully bootstraped environment %s!' ;
288
289
success ( message , colors . blue ( environment . name ) ) ;
@@ -575,7 +576,7 @@ async function initCommandLine() {
575
576
return response.stacks;
576
577
}
577
578
578
- async function cliDeploy ( stackNames : string [ ] , toolkitStackName : string ) {
579
+ async function cliDeploy(stackNames: string[], toolkitStackName: string, roleArn: string | undefined ) {
579
580
const stacks = await selectStacks(...stackNames);
580
581
renames.validateSelectedStacks(stacks);
581
582
@@ -595,7 +596,7 @@ async function initCommandLine() {
595
596
}
596
597
597
598
try {
598
- const result = await deployStack ( stack , aws , toolkitInfo , deployName ) ;
599
+ const result = await deployStack({ stack, sdk: aws, toolkitInfo, deployName, roleArn } );
599
600
const message = result.noOp ? ` ✅ Stack was already up - to - date , it has ARN $ { colors. blue ( result . stackArn ) } `
600
601
: ` ✅ Deployment of stack % s completed successfully , it has ARN $ { colors. blue ( result . stackArn ) } `;
601
602
data(result.stackArn);
@@ -611,7 +612,7 @@ async function initCommandLine() {
611
612
}
612
613
}
613
614
614
- async function cliDestroy ( stackNames : string [ ] , force : boolean ) {
615
+ async function cliDestroy(stackNames: string[], force: boolean, roleArn: string | undefined ) {
615
616
const stacks = await selectStacks(...stackNames);
616
617
renames.validateSelectedStacks(stacks);
617
618
@@ -628,7 +629,7 @@ async function initCommandLine() {
628
629
629
630
success(' ⏳ Starting destruction of stack %s...', colors.blue(deployName));
630
631
try {
631
- await destroyStack ( stack , aws , deployName ) ;
632
+ await destroyStack({ stack, sdk: aws, deployName, roleArn } );
632
633
success(' ✅ Stack %s successfully destroyed.', colors.blue(deployName));
633
634
} catch (e) {
634
635
error(' ❌ Destruction failed: %s', colors.blue(deployName), e);
0 commit comments