Skip to content

(@aws-cdk/aws-ec2): Stack verification failed for newer EBS volumeType #12816

@emmanuelnk

Description

@emmanuelnk

Creating a new volume with recently added newer volumeType e.g. GENERAL_PURPOSE_SSD_GP3 throws an error during verification with cdk synth or cdk deploy

Reproduction Steps

import * as cdk from '@aws-cdk/core'
import * as ec2 from '@aws-cdk/aws-ec2'

class ExampleVolume {
  constructor(scope: cdk.Construct) {
    const volume = new ec2.Volume(scope, 'example-volume', {
      availabilityZone: 'eu-central-1a',
      size: cdk.Size.gibibytes(100),
      // this fails while ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD will work
      volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, 
    })
  }
}

class ExampleStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props)
    new ExampleVolume(this)
  }
}

new ExampleStack(new cdk.App(), 'example-stack')

What did you expect to happen?

cdk synth verification to succeed

What actually happened?

Cannot destructure property 'Min' of 'sizeRanges[volumeType]' as it is undefined.
Subprocess exited with error 1

Environment

  • **CDK CLI Version :1.87.1
  • **Framework Version:1.87.1
  • **Node.js Version:14.15.1
  • **OS :Ubuntu 20.04
  • **Language (Version):TypeScript (3.8.3)

Other

The issue stems from this code:
https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-ec2/lib/volume.ts#L698-L708

sizeRanges object is not defined for newer volumeTypes such as GENERAL_PURPOSE_SSD_GP3 and many other EbsDeviceVolumeType such as GP3 etc. This causes the error described above to be thrown since Min and Max properties will be undefined


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudbugThis issue is a bug.effort/smallSmall work item – less than a day of effortneeds-triageThis issue or PR still needs to be triaged.p1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions