diff --git a/servicecatalog_puppet/cli.py b/servicecatalog_puppet/cli.py index a472f894f..ef0a4e8be 100644 --- a/servicecatalog_puppet/cli.py +++ b/servicecatalog_puppet/cli.py @@ -621,29 +621,41 @@ def deploy_launches(deployment_map, parameters, single_account, puppet_account_i logger.info('Finished creating stacks') +@cli.command() +@click.argument('puppet_account_id') +@click.argument('iam_role_arn') +def bootstrap_spoke_as(puppet_account_id, iam_role_arn): + with betterboto_client.CrossAccountClientContextManager('cloudformation', iam_role_arn, 'bootstrapping') as cloudformation: + do_bootstrap_spoke(puppet_account_id, cloudformation) + + @cli.command() @click.argument('puppet_account_id') def bootstrap_spoke(puppet_account_id): - logger.info('Starting bootstrap of spoke') with betterboto_client.ClientContextManager('cloudformation') as cloudformation: - template = read_from_site_packages('{}-spoke.template.yaml'.format(BOOTSTRAP_STACK_NAME)) - template = Template(template).render(VERSION=VERSION) - args = { - 'StackName': "{}-spoke".format(BOOTSTRAP_STACK_NAME), - 'TemplateBody': template, - 'Capabilities': ['CAPABILITY_NAMED_IAM'], - 'Parameters': [ - { - 'ParameterKey': 'PuppetAccountId', - 'ParameterValue': str(puppet_account_id), - }, { - 'ParameterKey': 'Version', - 'ParameterValue': VERSION, - 'UsePreviousValue': False, - }, - ], - } - cloudformation.create_or_update(**args) + do_bootstrap_spoke(puppet_account_id, cloudformation) + + +def do_bootstrap_spoke(puppet_account_id, cloudformation): + logger.info('Starting bootstrap of spoke') + template = read_from_site_packages('{}-spoke.template.yaml'.format(BOOTSTRAP_STACK_NAME)) + template = Template(template).render(VERSION=VERSION) + args = { + 'StackName': "{}-spoke".format(BOOTSTRAP_STACK_NAME), + 'TemplateBody': template, + 'Capabilities': ['CAPABILITY_NAMED_IAM'], + 'Parameters': [ + { + 'ParameterKey': 'PuppetAccountId', + 'ParameterValue': str(puppet_account_id), + }, { + 'ParameterKey': 'Version', + 'ParameterValue': VERSION, + 'UsePreviousValue': False, + }, + ], + } + cloudformation.create_or_update(**args) logger.info('Finished bootstrap of spoke') diff --git a/servicecatalog_puppet/requirements.txt b/servicecatalog_puppet/requirements.txt index 5e21644a8..c62b9ad1a 100644 --- a/servicecatalog_puppet/requirements.txt +++ b/servicecatalog_puppet/requirements.txt @@ -3,4 +3,4 @@ Jinja2==2.10.1 click==7.0 boto3==1.9.102 pykwalify==1.7.0 -better-boto==0.6.9 +better-boto==0.6.14 diff --git a/setup.py b/setup.py index 2a98456da..edf87daf4 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setuptools.setup( name="aws-service-catalog-puppet", - version="0.0.21", + version="0.0.22", author="Eamonn Faherty", author_email="aws-service-catalog-tools@amazon.com", description="Making it easier to deploy ServiceCatalog products",