Skip to content

ec2: a volume cannot be tagged at creation and cannot report or be filtered by its tags #670

Closed

Description

@scttfrdmn

Context

DescribeVolumes renders no tagSet and has no tag: or tag-key filter, and
CreateVolume parses no TagSpecification.N.*. So a volume cannot be tagged at creation
and a tagged volume cannot be found by tag — two halves of the same gap, which is why they
belong in one issue.

CreateTags on a volume ID is likewise worth checking: EC2's shared tag store is keyed by
resource ID, so a volume may already be taggable that way while being unable to report the
tags it holds.

Why it was deferred out of #666

v0.103.0 made a launch materialize its volumes. Honoring TagSpecification with
ResourceType=volume on RunInstances would have been natural to add there, but it would
have produced tags that no API could read back — DescribeVolumes has no tagSet — which is
exactly the store-and-hide shape #666 was fixing. CreateVolume parity has to come first,
and then the launch path is a small addition on top.

The launch-template note in docs/services.md already records that only the instance tag
scope is modeled; docs/services.md's new launch-time storage subsection records the same
for volumes.

Acceptance criteria

  • CreateVolume parses TagSpecification.N.ResourceType=volume with its
    Tag.M.{Key,Value} members and stores the tags on the volume.
  • DescribeVolumes renders tagSet>item>{key,value} per volume.
  • DescribeVolumes supports the tag:<key> and tag-key filters, following whatever
    the established EC2 filter helper does for other resources rather than a second
    hand-rolled implementation.
  • CreateTags / DeleteTags on a vol- ID reach the same store, verified rather than
    assumed — with a test asserting a tag added by CreateTags is visible in
    DescribeVolumes and filterable.
  • RunInstances honors TagSpecification with ResourceType=volume, tagging the
    volumes the launch creates, and the launch-template path inherits it.
  • The reserved-aws:-prefix rule and the 50-tag limit apply to volumes as they do to
    instances, or the difference is documented if AWS's rule differs.
  • docs/services.md — both the launch-time storage subsection and the tag-specification
    note updated.
  • CHANGELOG.md under ## [Unreleased].

Activity

  1. modified the milestones: v0.104.0, v0.105.0 on Aug 20, 2026
  2. scttfrdmn commented on Aug 20, 2026

    @scttfrdmn
    OwnerAuthor

    Moved to milestone v0.105.0. v0.104.0 ships the #662 privilege-boundary fix alone, matching how #660 shipped as v0.102.0 — a false-allow in the authorization path gets a release to itself.

    Correction to the premise

    The issue says CreateTags on a vol- ID "may already work" because EC2's tag store is keyed by resource ID. It does not. vol- is absent from ec2TaggableStateKey's prefix allowlist (emulator/ec2_plugin.go:2417-2444) — it maps i-, vpc-, subnet-, sg-, igw-, rtb-, eipalloc- and nat-, and returns ("", false) for anything else. Tagging a volume is therefore a silent no-op: no error, no tag. That is worse than an error, and it makes the "verified rather than assumed" acceptance criterion a fail-before test rather than a confirmation.

    Findings

    • EC2Volume.Tags []EC2Tag already exists (emulator/ec2_types.go:993-994), so there is no state migration — only producers and readers are missing.
    • DescribeTags is not implemented at all, for any resource type. Worth noting because it is the other surface a caller reaches for after tagging a volume.
    • createVolume (emulator/ec2_plugin.go:4675-4748) ignores TagSpecification.N — and also Iops, Throughput and KmsKeyId. Those three are adjacent discards in the same parser; decide explicitly whether they come along or stay out of scope.
    • AWS documents CreateVolume returning tagSet in its response, so the fix is not read-side only.
    • AWS documents exactly two tag filters on DescribeVolumes: tag:<key> and tag-key. No tag-value.
    • describeVolumes hand-rolls its filters as nine map[string]bool sets. That shape cannot express tag:<key>, because the filter name is not a fixed string — it carries the key. It needs extractEC2Filters, which is what the "established EC2 filter helper" criterion should name. That switch also has to settle a disagreement already in the tree: the two existing tag: implementations (ec2_plugin.go:868 and :3398) differ on what an empty value list means, and adopting one of them silently picks a side.
    • EC2LaunchTemplateData.TagSpecifications is a flat []EC2Tag with no resource-type discriminator, so a launch template cannot currently express "tag the volume but not the instance". The "launch-template path inherits it" criterion needs that type widened first, which is a larger change than it reads.
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