Returns the roster from the terraform state file, checks opts for location, but defaults to terraform.tfstate

def targets(tgt, tgt_type='glob', **kwargs):  # pylint: disable=W0613
    '''
    Returns the roster from the terraform state file, checks opts for location, but defaults to terraform.tfstate
    '''
    roster_file = os.path.abspath('terraform.tfstate')
    if __opts__.get('roster_file'):
        roster_file = os.path.abspath(__opts__['roster_file'])

    if not os.path.isfile(roster_file):
        log.error("Can't find terraform state file '%s'", roster_file)
        return {}

    log.debug('terraform roster: using %s state file', roster_file)

    if not roster_file.endswith('.tfstate'):
        log.error("Terraform roster can only be used with terraform state files")
        return {}

    raw = _parse_state_file(roster_file)
    log.debug('%s hosts in terraform state file', len(raw))
    return __utils__['roster_matcher.targets'](raw, tgt, tgt_type, 'ipv4')