Parses the terraform state file passing different resource types to the right handler

def _parse_state_file(state_file_path='terraform.tfstate'):
    '''
    Parses the terraform state file passing different resource types to the right handler
    '''
    ret = {}
    with salt.utils.files.fopen(state_file_path, 'r') as fh_:
        tfstate = salt.utils.json.load(fh_)

    modules = tfstate.get('modules')
    if not modules:
        log.error('Malformed tfstate file. No modules found')
        return ret

    for module in modules:
        resources = module.get('resources', [])
        for resource_name, resource in salt.ext.six.iteritems(resources):
            roster_entry = None
            if resource['type'] == 'salt_host':
                roster_entry = _handle_salt_host_resource(resource)

            if not roster_entry:
                continue

            minion_id = roster_entry.get(MINION_ID, resource.get('id'))
            if not minion_id:
                continue

            if MINION_ID in roster_entry:
                del roster_entry[MINION_ID]
            _add_ssh_key(roster_entry)
            ret[minion_id] = roster_entry
    return ret