Repository navigation
feat(tagging): reach all four ELBv2 taggable types (#863) - #1041
Merged
Merged
Conversation
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
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gives the Resource Groups Tagging API an
elasticloadbalancingarm, 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.
resolveARNhad no arm for the service, soTagResourceson any of the four failed at the resolver, andGetResourcesreported 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 toelbResolveTaggedResource— the resolver ELBv2's ownAddTagsuses — 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.
tagResolveFailuretherefore delegateserrTagResourceNotFoundtotagMergeFailure, so an absent load balancer answersInvalidParameterException/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_taggedandResourceTypeFiltersAll four ELB records gained
ever_tagged(#938): the moment ELB becomes scannable,GetResourcesmust 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".ResourceTypeFiltersneeded no ELB-specific handling — #936's anchored-segment rule already yieldsloadbalancer,targetgroup,listenerandlistener-rulefrom the ARNs themselves.A classic load-balancer ARN is refused by arity
elbResourceKindFromARNdecided 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 answeredLoadBalancerNotFound/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 ownAddTagsalready 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
newELBTestServerregisters the ELB plugin alone and so cannot serve a cross-readability assertion, andemulator.StartTestServerreturns a different type.URLis 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 underGOTOOLCHAIN=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