Skip to content

feat(tagging): reach all four ELBv2 taggable types (#863) - #1041

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/863-tagging-elb-arm
Sep 17, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/863-tagging-elb-arm

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Gives the Resource Groups Tagging API an elasticloadbalancing arm, so all four of ELBv2's taggable types — load balancer, target group, listener and listener rule — are taggable and discoverable through it.

What was missing

ELBv2 has kept its own tag store since #748 and the tagging API could reach none of it. resolveARN had no arm for the service, so TagResources on any of the four failed at the resolver, and GetResources reported none of them. That left #765's standing rule — a tag written through one API must be readable through the other — unmet for a service substrate models fully. Every test here crosses the two APIs over the wire in both directions; nothing writes state directly.

The first arm that finds its key instead of building one

Every other arm turns an ARN into a state key by building one. ELB's cannot: a listener's and a rule's key carries a generateELBSuffix()-minted suffix that no ARN component yields. So the arm delegates to elbResolveTaggedResource — the resolver ELBv2's own AddTags uses — rather than rebuilding a key that could drift from it, which is the rule #935 established after the SQS, DynamoDB and Lambda drifts (#826, #932, #943).

One observable consequence, and it is deliberate: an absent ELB resource is discovered by the resolver rather than by the merge. tagResolveFailure therefore delegates errTagResourceNotFound to tagMergeFailure, so an absent load balancer answers InvalidParameterException/400 exactly as an absent DynamoDB table does (#939) — a caller must not be able to tell which stage found it missing, because the two are the same fact.

ever_tagged and ResourceTypeFilters

All four ELB records gained ever_tagged (#938): the moment ELB becomes scannable, GetResources must report what has been tagged rather than what is tagged, so a caller can distinguish "this resource's tags were removed" from "this resource was never tagged".

ResourceTypeFilters needed no ELB-specific handling — #936's anchored-segment rule already yields loadbalancer, targetgroup, listener and listener-rule from the ARNs themselves.

A classic load-balancer ARN is refused by arity

elbResourceKindFromARN decided a resource's type by testing for the :loadbalancer/ substring, which AWS's classic format matches too — one segment after the type where ELBv2's carries three (app/<name>/<id>). A classic ARN was therefore looked for among v2 load balancers and answered LoadBalancerNotFound/400, which asserts a v2 load balancer of that ARN could exist.

Classification is now on the segment counts the vendored authzref/elasticloadbalancing.json (v1.4) format strings publish, so a classic ARN is a type substrate does not tag: ValidationError/400, which is what ELB's own AddTags already answered for an ARN of no ELB type. Nothing writes a classic record and nothing ever did, so no tag was mis-keyed in practice — #863's premise that the two collide in state was corrected on the issue before this landed. What changes is that the refusal is principled rather than incidental, which matters the moment #844 lets a classic load balancer exist. The pre-#774 nested listener and rule ARNs stay resolvable, by arity rather than by substring, for the reason they always were: a recorded event log or exported fixture carries them.

Test-helper refactor

newELBTestServer registers the ELB plugin alone and so cannot serve a cross-readability assertion, and emulator.StartTestServer returns a different type. URL is a field on each and a field satisfies no interface, so six ELB helpers now take the base URL string both already expose.

Verification

The nine-command gate passes: gofmt/build/vet, golangci-lint, make test, the same under GOTOOLCHAIN=go1.26.6, make coverage, the four docs/authz reference checks, the docs site build, and the e2e suite. Coverage holds at 85.1% emulator / 84.6% total.

Closes #863

ELBv2 has kept its own tag store since #748 and the Resource Groups Tagging
API could reach none of it: resolveARN had no `elasticloadbalancing` arm, so
TagResources on a load balancer, target group, listener or rule failed at the
resolver, and GetResources reported none of the four. #765's standing rule — a
tag written through one API is readable through the other — was unmet for a
service substrate models fully.

This is the first arm that *finds* its state key instead of building one. A
listener's and a rule's key carries a generateELBSuffix-minted suffix that no
ARN component yields, so the arm delegates to elbResolveTaggedResource — the
resolver ELBv2's own AddTags uses — rather than rebuilding a key that could
drift from it (#935). One observable consequence: an absent ELB resource is
discovered before the merge runs, so tagResolveFailure delegates
errTagResourceNotFound to tagMergeFailure and a caller cannot tell which stage
found it missing (#939).

All four ELB records gained `ever_tagged` (#938), because the moment ELB
becomes scannable GetResources must report what has been tagged rather than
what is tagged. ResourceTypeFilters needs no ELB handling: #936's anchored
segment rule already yields loadbalancer, targetgroup, listener and
listener-rule from the ARNs.

elbResourceKindFromARN now classifies by segment arity rather than by
substring, so a *classic* load-balancer ARN — one segment after
`loadbalancer/` where ELBv2's carries three — is a type substrate does not
tag (ValidationError/400) rather than a v2 load balancer that happens to be
absent (LoadBalancerNotFound/400). Nothing writes a classic record, so no tag
was ever mis-keyed; #863's premise that the two collide in state was corrected
on the issue before this landed. The refusal is now principled rather than
incidental, which matters the moment #844 lets a classic load balancer exist.

Six ELB test helpers now take a base URL rather than a *httptest.Server, so
one StartTestServer can carry both ELBv2 and the tagging API — newELBTestServer
registers the ELB plugin alone and cannot serve a cross-readability assertion.

Closes #863
@scttfrdmn
scttfrdmn merged commit 594be7c into main Sep 17, 2026
16 checks passed
@scttfrdmn
scttfrdmn deleted the feat/863-tagging-elb-arm branch September 17, 2026 20:54
@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.43478% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/tagging_plugin.go 84.00% 7 Missing and 1 partial ⚠️
emulator/elb_tags.go 95.23% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tagging: resolveARN has no elasticloadbalancing arm, so the Resource Groups Tagging API reaches no ELB resource

1 participant