Delete target group.

    name
        (string) - Target Group Name or Amazon Resource Name (ARN).

    returns
        (bool) - True on success, False on failure.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elbv2.delete_target_group arn:aws:elasticloadbalancing:us-west-2:644138682826:targetgroup/learn1give1-api/414788a16b5cf163

def delete_target_group(name,
                        region=None,
                        key=None,
                        keyid=None,
                        profile=None):
    '''
    Delete target group.

    name
        (string) - Target Group Name or Amazon Resource Name (ARN).

    returns
        (bool) - True on success, False on failure.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elbv2.delete_target_group arn:aws:elasticloadbalancing:us-west-2:644138682826:targetgroup/learn1give1-api/414788a16b5cf163
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if not target_group_exists(name, region, key, keyid, profile):
        return True

    try:
        if name.startswith('arn:aws:elasticloadbalancing'):
            conn.delete_target_group(TargetGroupArn=name)
            log.info('Deleted target group %s', name)
        else:
            tg_info = conn.describe_target_groups(Names=[name])
            if len(tg_info['TargetGroups']) != 1:
                return False
            arn = tg_info['TargetGroups'][0]['TargetGroupArn']
            conn.delete_target_group(TargetGroupArn=arn)
            log.info('Deleted target group %s ARN %s', name, arn)
        return True
    except ClientError as error:
        log.error('Failed to delete target group %s', name,
                  exc_info_on_loglevel=logging.DEBUG)
        return False