src/subnet_groups.js
function buildElastiCacheSubnetGroup(numZones = 0, { name = 'ElastiCacheSubnetGroup' } = {}) {
  if (numZones < 1) {
    return {};
  }

  const subnetIds = [];
  for (let i = 1; i <= numZones; i += 1) {
    subnetIds.push({ Ref: `${DB_SUBNET}Subnet${i}` });
  }

  return {
    [name]: {
      Type: 'AWS::ElastiCache::SubnetGroup',
      Properties: {
        CacheSubnetGroupName: {
          Ref: 'AWS::StackName',
        },
        Description: {
          Ref: 'AWS::StackName',
        },
        SubnetIds: subnetIds,
      },
    },
  };
}
function buildElastiCacheSubnetGroup(numZones = 0, { name = 'ElastiCacheSubnetGroup' } = {}) {
  if (numZones < 1) {
    return {};
  }

  const subnetIds = [];
  for (let i = 1; i <= numZones; i += 1) {
    subnetIds.push({ Ref: `${DB_SUBNET}Subnet${i}` });
  }

  return {
    [name]: {
      Type: 'AWS::ElastiCache::SubnetGroup',
      Properties: {
        CacheSubnetGroupName: {
          Ref: 'AWS::StackName',
        },
        Description: {
          Ref: 'AWS::StackName',
        },
        SubnetIds: subnetIds,
      },
    },
  };
}
function buildElastiCacheSubnetGroup ( numZones = 0 , { name = 'ElastiCacheSubnetGroup' } = { } ) { if ( numZones < 1 ) { return { } ; } const subnetIds = [ ] ; for ( let i = 1 ; i <= numZones ; i += 1 ) { subnetIds . push ( { Ref : ` ${ DB_SUBNET } ${ i } ` } ) ; } return { [ name ] : { Type : 'AWS::ElastiCache::SubnetGroup' , Properties : { CacheSubnetGroupName : { Ref : 'AWS::StackName' , } , Description : { Ref : 'AWS::StackName' , } , SubnetIds : subnetIds , } , } , } ; }
Build an ElastiCacheSubnetGroup for a given number of zones

@param {Number} numZones Number of availability zones
@param {Object} params
@return {Object}
Build an ElastiCacheSubnetGroup for a given number of zones