def test_version_2_manifest_stackset_sm_input(s3_setup, organizations_setup,
                                              ssm_client):
    manifest_name = 'manifest_version_2.yaml'
    file_path = TESTS_DIR + manifest_name
    os.environ['MANIFEST_FILE_NAME'] = manifest_name
    os.environ['MANIFEST_FILE_PATH'] = file_path
    os.environ['MANIFEST_FOLDER'] = file_path[:-len(manifest_name)]
    os.environ['STAGE_NAME'] = 'stackset'
    sm_input_list = parse.stack_set_manifest()
    logger.info("Stack Set sm_input_list:")
    logger.info(sm_input_list)
    # check if namespace CustomControlTower is added to the stack name
    assert sm_input_list[0]['ResourceProperties']['StackSetName'] == \
           "CustomControlTower-stackset-1"
    # check the account list should have 2 accounts - Developer1 only (not
    # Developer1-SuperSet
    assert len(sm_input_list[0]['ResourceProperties']['AccountList']) == 2
    # check if export_outputs is not defined then SSMParameters is set to
    # empty dict
    assert sm_input_list[1]['ResourceProperties']['SSMParameters'] == {}
    # check the account list should have 3 accounts - Developer1 only (not
    # Developer1-SuperSet
    assert len(sm_input_list[1]['ResourceProperties']['AccountList']) == 3
    # check if empty OU, account list should be empty string
    assert sm_input_list[2]['ResourceProperties']['AccountList'] == []
    # parameters key has empty dict
    assert sm_input_list[2]['ResourceProperties']['Parameters'] == {}
Exemplo n.º 2
0
def test_version_1_manifest_stackset_sm_input(s3_setup, organizations_setup,
                                              ssm_client):
    manifest_name = 'manifest_version_1.yaml'
    file_path = TESTS_DIR + manifest_name
    os.environ['MANIFEST_FILE_NAME'] = manifest_name
    os.environ['MANIFEST_FILE_PATH'] = file_path
    os.environ['MANIFEST_FOLDER'] = file_path[:-len(manifest_name)]
    os.environ['STAGE_NAME'] = 'stackset'
    sm_input_list = parse.stack_set_manifest()
    logger.info("Stack Set sm_input_list:")
    logger.info(sm_input_list)
    assert sm_input_list[0]['ResourceProperties']['StackSetName'] == \
           "CustomControlTower-stackset-1"
    assert sm_input_list[1]['ResourceProperties']['StackSetName'] == \
           "CustomControlTower-stackset-2"
def get_stack_set_inputs() -> list:
    return parse.stack_set_manifest()