Skip to content

feat(#844): deploy a classic load balancer from CloudFormation - #1318

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/844-classic-elb-cfn
Oct 1, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/844-classic-elb-cfn

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

AWS::ElasticLoadBalancing::LoadBalancer — no V2 — had no arm in dispatchResource at all, so
a stack declaring one reached the generic stub: it reported CREATE_COMPLETE for a load balancer no
DescribeLoadBalancers of either generation could find. This is #844's Tier 2, the last of its nine
acceptance rows, and it completes the issue.

What it does

deployELBClassicLoadBalancer dispatches the 2012-06-01 CreateLoadBalancer. Seven properties
are forwarded: LoadBalancerName (defaulting to the logical ID), Scheme, Listeners,
AvailabilityZones, Subnets, SecurityGroups and Tags. The stack sweep deletes it through the
classic DeleteLoadBalancer, and the classic type joins cfnELBStampableTypes so the
aws:cloudformation:* stamp and the stack's own tags reach the record.

Version is the whole of the routing. CreateLoadBalancer is one of the six action names both
generations publish, so the same params without it reach the ELBv2 handler and quietly create an
Application Load Balancer — which would still answer a Ref and a plausible DNS name. Dropping it
from the deploy helper fails all six tests; dropping it from the deleter fails the sweep test. Both
controls were run.

The classic delete could not reuse queryDeleter, which emits exactly one parameter: it needs
LoadBalancerName and Version, so it is an inline deleter like AWS::EC2::EIP's.

The acceptance criterion that was wrong

AC8 ends "and !Ref on the type resolves to it [the DNS name]", and docs/services.md recorded the
same claim among the divergences substrate cannot fix. AWS documents the opposite:

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the
name of the load balancer.

The DNS name is Fn::GetAtt DNSName, one of five published attributes. So there was never a Ref
divergence — the entry is deleted rather than amended, and the helper needed no Ref arm,
because the name is the physical ID the default already answers. Per #671, substrate models what the
published page states; the correction is also posted on the issue.

cfn_intrinsics.go is therefore untouched. DNSName resolves through step 2 of cfnGetAttValue
(recorded metadata), and CanonicalHostedZoneName, CanonicalHostedZoneNameID,
SourceSecurityGroup.GroupName and SourceSecurityGroup.OwnerAlias answer empty already,
because cfnGetAttNamesAnARN refuses an attribute containing a . or not ending in Arn. Those four
are #1013 absences stated as such: a plausible-looking hosted-zone ID in a stack Output is worse
than a missing one, because a consumer asserts against it happily.

Deliberately dropped

PolicyNames (the sixth listener member) and the nine remaining CFN properties —
AccessLoggingPolicy, AppCookieStickinessPolicy, ConnectionDrainingPolicy,
ConnectionSettings, CrossZone, HealthCheck, Instances, LBCookieStickinessPolicy,
Policies. Each needs a LoadBalancerDescription member the record does not hold, and reporting a
health check or a registered instance no describe could show is a worse answer than omitting it. That
is the same boundary the unrouted classic operations sit behind, and docs/services.md now states
the reason rather than just the list.

Tests

emulator/cfn_elb_classic_test.go, eleven tests and subtests, every one reading the result back
through the classic API rather than off the returned DeployedResource — a test satisfied by the
physical ID and the ARN would have passed against the stub, which is how the stub survived:

  • the round trip, including that an omitted InstanceProtocol stays omitted;
  • the generation control — the classic deploy creates no ELBv2 load balancer;
  • Ref is the name, GetAtt DNSName equals what the API itself reports, the two differ, and the
    other four attributes are empty;
  • the template's own tag and all three stamp keys, read through classic DescribeTags, plus the
    classic ARN arity;
  • the sweep deletes it and a second delete still succeeds (published idempotency);
  • CREATE_FAILED for a template omitting Listeners;
  • five flattening edges — a scalar Listeners, a listener missing its Protocol (ends the list), a
    non-object listener (leaves a gap the API refuses), malformed tag entries (skipped, the rest stay
    contiguous), and a scalar Tags.

100% patch coverage on all three new functions. make lint 0 issues; make test green; the seven
check targets pass with the #756 ratchet byte-identical at 319 declared, 133 projected across 50
records, 186 still reachable
.

Closes #844

AWS::ElasticLoadBalancing::LoadBalancer had no arm in dispatchResource, so a
stack declaring one reached the generic stub: CREATE_COMPLETE for a load
balancer no DescribeLoadBalancers of either generation could find. It now
deploys through the 2012-06-01 CreateLoadBalancer.

The whole of what makes that call classic is the Query Version member — the
action name is published by both generations — so a helper omitting it would
have created an Application Load Balancer that still answered a Ref and a
plausible DNS name. The negative control for that is the one test that fails
when Version is dropped from the params.

Ref needed no arm: AWS publishes it as "the name of the load balancer", which
is the physical ID the default already answers, so the docs/services.md entry
recording a DNS-name divergence is deleted rather than implemented. DNSName is
GetAtt, answered from recorded metadata; the four other published attributes
answer empty, which is the honest answer for a hosted zone and a source
security group substrate mints nothing for.

Closes #844
@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 66b2d12 into main Oct 1, 2026
18 checks passed
@scttfrdmn
scttfrdmn deleted the feat/844-classic-elb-cfn branch October 1, 2026 18:34
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.

elb: the classic (2012-06-01) Elastic Load Balancing API is unrouted, so aws elb create-load-balancer is refused for a v2 parameter name

1 participant