src/vpc.js
function buildSubnet(name, position, zone, cidrBlock) {
  const cfName = `${name}Subnet${position}`;
  return {
    [cfName]: {
      Type: 'AWS::EC2::Subnet',
      Properties: {
        AvailabilityZone: zone,
        CidrBlock: cidrBlock,
        Tags: [
          {
            Key: 'Name',
            Value: {
              'Fn::Join': [
                '-',
                [
                  {
                    Ref: 'AWS::StackName',
                  },
                  name.toLowerCase(),
                  zone,
                ],
              ],
            },
          },
        ],
        VpcId: {
          Ref: 'VPC',
        },
      },
    },
  };
}
function buildSubnet(name, position, zone, cidrBlock) {
  const cfName = `${name}Subnet${position}`;
  return {
    [cfName]: {
      Type: 'AWS::EC2::Subnet',
      Properties: {
        AvailabilityZone: zone,
        CidrBlock: cidrBlock,
        Tags: [
          {
            Key: 'Name',
            Value: {
              'Fn::Join': [
                '-',
                [
                  {
                    Ref: 'AWS::StackName',
                  },
                  name.toLowerCase(),
                  zone,
                ],
              ],
            },
          },
        ],
        VpcId: {
          Ref: 'VPC',
        },
      },
    },
  };
}
function buildSubnet ( name , position , zone , cidrBlock ) { const cfName = ` ${ name } ${ position } ` ; return { [ cfName ] : { Type : 'AWS::EC2::Subnet' , Properties : { AvailabilityZone : zone , CidrBlock : cidrBlock , Tags : [ { Key : 'Name' , Value : { 'Fn::Join' : [ '-' , [ { Ref : 'AWS::StackName' , } , name . toLowerCase ( ) , zone , ] , ] , } , } , ] , VpcId : { Ref : 'VPC' , } , } , } , } ; }
Create a subnet

@param {String} name Name of subnet
@param {Number} position Subnet position
@param {String} zone Availability zone
@param {String} cidrBlock Subnet CIDR block
@return {Object}
Create a subnet