Repository navigation
Description
Substrate mints an ELBv2 listener ARN by appending to the load balancer's own ARN, and a
rule ARN by appending to the listener's:
emulator/elb_types.go—elbListenerARN(lbARN, suffix) = lbARN + "/listener/" + suffixemulator/elb_types.go—elbRuleARN(listenerARN, suffix) = listenerARN + "/rule/" + suffix
So substrate produces
arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/web/0abc.../listener/0def...
arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/web/0abc.../listener/0def.../rule/0123...
AWS's published ARNs are flat and carry their own resource type:
arn:aws:elasticloadbalancing:us-east-1:123456789012:listener/app/web/0abc.../0def...
arn:aws:elasticloadbalancing:us-east-1:123456789012:listener-rule/app/web/0abc.../0def.../0123...
(See the ARN examples in the ELBv2 API reference's Listener and Rule types, and the
resource-ARN table in the ELB user guide's IAM page.)
Why it matters
Two observable consequences:
- A policy scoped to a listener or a rule matches nothing. Every AWS-authored
example writes the Resource of a listener statement as
arn:aws:elasticloadbalancing:*:*:listener/*and a rule statement as
…:listener-rule/*. Neither pattern matches substrate's ARN, whose resource type
segment isloadbalancer. ADenywritten that way silently fails to deny. - A consumer parsing the ARN reads the wrong resource type. Anything splitting on
the sixth colon segment getsloadbalancer/app/web/0abc.../listener/0def...where AWS
giveslistener/app/web/0abc.../0def....
Not covered by #748
#748 added ELB tagging and the elasticloadbalancing:CreateAction second pass. It works
around this rather than fixing it: the tag-on-create pass authorizes against the
AWS-correct type wildcards (listener/*, listener-rule/*), because those are what
a policy is written against, and elbResourceKindFromARN recognises both shapes so a
caller passing a real-shaped ARN to AddTags/DescribeTags is not told it names nothing.
The ARNs substrate mints are unchanged.
Acceptance criteria
-
elbListenerARNandelbRuleARNproduce AWS's flat shape, taking the load
balancer's type/name/id and the listener's id as separate inputs. -
extractELBNameFromARN/extractELBSuffixFromARNstill resolve the state keys
they resolve today (the listener list is keyed by load-balancer name, and the rule
list by listener suffix). -
DescribeListeners'LoadBalancerArnfilter andDescribeRules'ListenerArn
filter still work, neither of which can be derived from the new ARN by prefix. - A test asserts a policy scoped to
…:listener/*allowsModifyListenerand one
scoped to…:listener-rule/*allowsDeleteRule. -
## Compatibilityrecords that recorded state and exported fixtures carry the old
ARNs, and that a consumer asserting a listener ARN verbatim sees it change.
Activity
feat(elb): the listener and rule ARN shape AWS publishes (#774) (#823)