def describe_stack()

in lambdas/custom_resources/CTE_CrossAccountCloudFormation/src/cfn_helper.py [0:0]


def describe_stack(stack_name, session=None):
    """Performs describe_stack on the provided stack name

    http://boto3.readthedocs.io/en/latest/reference/services/cloudformation.html#CloudFormation.Client.describe_stacks

    Args:
        stack_name (str): Name of the stack to describe
        session (object, optional): boto3 session object

    Returns:
        dict: Standard AWS dictionary with stack details
    """
    client = boto3_client(service='cloudformation', session=session)
    try:
        logger.info(f"Getting details about CloudFormation Stack:{stack_name}")
        response = client.describe_stacks(StackName=stack_name)
        return response

    except ex.ClientError as e:
        if str(e).endswith(" does not exist"):
            logger.warning(f"Stack, {stack_name} does not exist...")
            # return False

        else:
            raise ex.ClientError(
                f"Failed to lookup stack {stack_name}: {str(e)}"
            )

    except Exception as e:
        logger.warning(f"describe_stack error:{str(e)}")