Ensure ElastiCache subnet group exists.

    .. versionadded:: 2015.8.0

    name
        The name for the ElastiCache subnet group. This value is stored as a lowercase string.

    subnet_ids
        A list of VPC subnet IDs for the cache subnet group.  Exclusive with subnet_names.

    subnet_names
        A list of VPC subnet names for the cache subnet group.  Exclusive with subnet_ids.

    description
        Subnet group description.

    tags
        A list of tags.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.

def subnet_group_present(name, subnet_ids=None, subnet_names=None,
                         description=None, tags=None, region=None,
                         key=None, keyid=None, profile=None):
    '''
    Ensure ElastiCache subnet group exists.

    .. versionadded:: 2015.8.0

    name
        The name for the ElastiCache subnet group. This value is stored as a lowercase string.

    subnet_ids
        A list of VPC subnet IDs for the cache subnet group.  Exclusive with subnet_names.

    subnet_names
        A list of VPC subnet names for the cache subnet group.  Exclusive with subnet_ids.

    description
        Subnet group description.

    tags
        A list of tags.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.
    '''
    ret = {'name': name,
           'result': True,
           'comment': '',
           'changes': {}
           }

    exists = __salt__['boto_elasticache.subnet_group_exists'](name=name, tags=tags, region=region, key=key,
                                                              keyid=keyid, profile=profile)
    if not exists:
        if __opts__['test']:
            ret['comment'] = 'Subnet group {0} is set to be created.'.format(name)
            ret['result'] = None
            return ret
        created = __salt__['boto_elasticache.create_subnet_group'](name=name, subnet_ids=subnet_ids,
                                                                   subnet_names=subnet_names,
                                                                   description=description, tags=tags,
                                                                   region=region, key=key, keyid=keyid,
                                                                   profile=profile)
        if not created:
            ret['result'] = False
            ret['comment'] = 'Failed to create {0} subnet group.'.format(name)
            return ret
        ret['changes']['old'] = None
        ret['changes']['new'] = name
        ret['comment'] = 'Subnet group {0} created.'.format(name)
        return ret
    ret['comment'] = 'Subnet group present.'
    return ret