Skip to content

ec2: CreateVolume with neither Size nor SnapshotId produces an 8 GiB volume where AWS refuses #712

Closed

Description

@scttfrdmn

createVolume (emulator/ec2_plugin.go:5024-5030) falls back to ec2DefaultVolumeSizeGiB (8)
when Size is absent. #689 made a named SnapshotId supply the size, and recorded the
remaining half in a comment rather than fixing it:

A request naming neither Size nor SnapshotId still gets the 8 GiB default rather
than the refusal AWS documents ("Size is required unless SnapshotId is specified").
That is a wider change than this one and a follow-up.

So CreateVolume with no parameters at all succeeds and produces an 8 GiB gp2 volume in
us-east-1a, where real EC2 refuses. Two neighbouring silent-default rules in the same function
belong in the same decision:

The reason it is wider than #689: ec2DefaultVolumeSizeGiB is reached from the launch path too,
where a mapping legitimately has no size, so the constant cannot simply be removed — the refusal
has to live at CreateVolume's own parameter parse.

Acceptance criteria

  • CreateVolume with neither Size nor SnapshotId is refused, with the code, message and
    status verified against AWS's CreateVolume reference (MissingParameter vs
    InvalidParameterValue decided on evidence, not assumption).
  • An unparseable or non-positive Size is refused rather than silently defaulted.
  • A decision recorded for a missing AvailabilityZone: refuse, or keep the default and say
    why in the doc comment.
  • ec2DefaultVolumeSizeGiB's remaining callers documented, so it is clear the launch path
    still needs it.
  • Table-driven tests per case, and any existing test that relied on the silent default
    rewritten rather than extended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions