Description
The defect
GetResources reports an ECS cluster and nothing else in the ecs namespace.
scanECSClusters (emulator/tagging_plugin.go:559) is the only ECS descriptor
(:251), while ecsTagStateKey (emulator/ecs_plugin.go:1221) resolves four ECS ARN
shapes — cluster, service, task and task definition — and mergeResourceTags' ecs arm
writes tags to all four through ecsMergeRecordTags.
So a tag written to a service, a task or a task definition through TagResources is
readable through ECS's own ListTagsForResource and invisible to a caller discovering
resources. That is the asymmetry each of #835's other nine rows closed with its scanner,
and it is the last piece of that issue: criterion 1 (a mergeResourceTags arm) and
criterion 2 (readable through the owning service) are met for all eleven types;
criterion 3 (GetResources reports the tag) is met for nine.
A task is in scope alongside the two rows #835 names. ecsTagStateKey reaches one,
and AWS's ECS tagging page lists tasks first among the resources that support tags —
"There are multiple ways that Amazon ECS tasks, services, task definitions, and clusters
are tagged". So this is three descriptors, not two.
Verified
From Tagging Amazon ECS
resources,
the Tagging support for Amazon ECS resources table: tasks, services, task definitions and
clusters all read Supports tags: Yes (as do task sets, container instances, external
instances and capacity providers, none of which substrate models). "A maximum of 50 tags
can be associated with a resource."
From API_GetResources:
"Returns all the tagged or previously tagged resources that are located in the specified
AWS Region for the account", and ResourceTypeFilters takes service[:resourceType]
where "The string for each service name and resource type is the same as that embedded in a
resource's Amazon Resource Name (ARN)" — so the filters are ecs:cluster, ecs:service,
ecs:task and ecs:task-definition. The tagging guide's welcome page, which
API_TagResources names as authoritative, states that "The GetResources, GetTagKeys,
and GetTagValues operations support all resource types".
Scope
The state keys the scanners enumerate already exist and are account- and Region-qualified
(emulator/ecs_plugin.go:109-143):
| Type | Key | ARN member |
|---|---|---|
| service | service:{acct}/{region}/{cluster}/{name} |
ECSService.ServiceArn |
| task | task:{acct}/{region}/{cluster}/{id} |
ECSTask.TaskArn |
| task definition | taskdef:{acct}/{region}/{family}/{revision} |
ECSTaskDefinition.TaskDefinitionArn |
Each collides with a sibling index key under a bare-prefix test — service_names:,
task_ids:, taskdef_families:, taskdef_revisions: — so the prefixes are tested
colon-terminated, which is now the default for a new row (six namespaces have collided).
The four ECS scanners become Region-scoped. scanECSClusters prefixes by account only,
so a caller in us-west-2 is reported a us-east-1 cluster, contradicting the sentence
quoted above. It is fixed here rather than left for the wider audit, because a service
whose clusters answer cross-Region and whose services answer same-Region gives one caller
two different answers about the same namespace. The same defect in fourteen other scanners,
and a cross-account variant in three, is a separate issue.
Acceptance criteria
-
GetResourcesreports an ECS service, task and task definition, with their tags. - Each is created through its owning operation (
CreateService,RunTask,
RegisterTaskDefinition) and its tag written throughTagResources, then read back
through ECS's ownListTagsForResource— cfn: the aws:cloudformation:* stamp covers EC2 only, so the rest of a stack is unstamped #765's rule, both directions. -
ResourceTypeFiltersofecs:service,ecs:taskandecs:task-definitioneach
select only their own type, andecsselects all four. - The four ECS scanners report nothing from another Region, asserted through a real
request to the other Region's endpoint. - The three prefixes are tested colon-terminated, with a test that an index key is not
reported as a resource. - Tag order is sorted by key, per tagging: the four merge helpers store a resource's tags in Go map order, so one state hashes two ways #862.
-
CHANGELOG.mdanddocs/services.mdrecord the row, anddocs/services.md's
GetResourcestype count and the The Resource Groups Tagging API cannot write tags for eleven types: mergeResourceTags has no arm #835 tally are corrected — the tally has been
undercounting since feat(tagging): reach an ACM certificate and a CloudFront distribution (#835) #920 (see the correction comment on The Resource Groups Tagging API cannot write tags for eleven types: mergeResourceTags has no arm #835). - The Resource Groups Tagging API cannot write tags for eleven types: mergeResourceTags has no arm #835 closes.
Activity
feat(tagging): reach all four ELBv2 taggable types (#863) (#1041)