in critter/stack.py [0:0]
def deploy(self):
logger.info(f"Deploying CloudFormation template '{self.template_file}' as stack '{self.stack_name}'")
self.deploy_action_performed = None
try:
self.cfn.create_stack(
StackName=self.stack_name,
TemplateBody=self.template_body,
OnFailure="DELETE",
Capabilities=self.cfn_capabilities,
Tags=self.stack_tags,
)
logger.info(f"Waiting for CloudFormation stack '{self.stack_name}' creation to complete")
self.cfn.get_waiter("stack_create_complete").wait(
StackName=self.stack_name, WaiterConfig=self.CFN_WAITER_CONFIG
)
self.deploy_action_performed = "CREATE"
except botocore.exceptions.ClientError as e:
if e.response["Error"]["Code"] == "AlreadyExistsException":
self.update()
elif e.response["Error"]["Code"] == "InsufficientCapabilitiesException":
logger.error("Error - Specify required CloudFormation capabilities with '--capabilities CAPABILITY'")
raise e
else:
raise e
self.stack = boto3.resource("cloudformation").Stack(self.stack_name)
logger.info(f"Deployed CloudFormation stack '{self.stack.stack_id}'")