cast the value depending on the terraform type

def _cast_output_to_type(value, typ):
    '''cast the value depending on the terraform type'''
    if typ == 'b':
        return bool(value)
    if typ == 'i':
        return int(value)
    return value