fix(route53resolver): CreateResolverEndpoint reads IpAddresses, as AWS names it (#4180)

* fix(route53resolver): CreateResolverEndpoint reads IpAddresses, as AWS names it

CreateResolverEndpoint read its address list from a member called
IpAddressRequests. AWS names that member IpAddresses; the list's SHAPE is named
IpAddressRequest, which is where the wrong wire name came from.

The distinction is not cosmetic. Every AWS SDK, the CLI and the Terraform
provider serialise IpAddresses, and the CLI refuses to send IpAddressRequests at
all because no such member exists in its model. So the operation dispatched and
no real client could call it:

  {"Name":"ep","Direction":"INBOUND","SecurityGroupIds":["sg-1"],
   "IpAddresses":[{"SubnetId":"subnet-1"}]}
  -> 400 InvalidParameterException: IpAddressRequests is required

That is the worst shape a gap can take, because every cheap check says the
service works: it is in the service directory, /_floci/health lists it, an
operation-name grep finds it, and a does-it-route probe passes.

Reads IpAddresses, still accepting the old spelling so anything written against
the previous behaviour keeps working — the existing CustomResources tests use it
and are untouched. The error message names only the AWS member, since it is the
sole hint a caller gets. The idempotency record keeps its internal member name
deliberately: renaming it would make every endpoint stored by an earlier build
read as absent, which that code reports as a replay conflict.

Tests: the AWS member is accepted, the legacy one still is, a retry that switches
between the two spellings is not a conflict, and the missing-member error names
IpAddresses. 55 Route53Resolver tests pass.

Reported as #4108. Found while confirming that an earlier finding — Route53Resolver
absent entirely — had been fixed upstream: the probe written for it asserted only
that the call dispatches, which is what let this hide behind it.

* style: use -- rather than an em dash in added prose

AGENTS.md forbids em dashes in all content and the conformance check flags them.
Two in javadoc lines this branch added. Comments only, no behaviour change.

* docs(route53resolver): name the list shape correctly, and trim the member note

The list shape is `IpAddressesRequest`; `IpAddressRequest` is the shape of each
element, and that element name is where the wrong wire spelling came from. Both
the service doc and the Javadoc on ipAddressesOf had it as the list's own name.

The Javadoc also carried a paragraph on how the bug stayed hidden, which the PR
description already covers at length. What a reader of this method needs is the
member name and the legacy alias, so that is what is left.
This commit is contained in:
Allen Sanborn authored and GitHub committed 2026-09-23 11:20:50 -04:00
1 parent b2e2d116d8
commit daecc6da17
3 files changed
+113 -5

No files matched your search

@@ -86,4 +86,90 @@ class Route53ResolverIntegrationTest {
.then()
.statusCode(400);
}
// ── CreateResolverEndpoint: the request member is IpAddresses ──────────────
//
// AWS names it IpAddresses; its list shape is named IpAddressRequest, which is
// where the emulator's earlier wire name came from. Every SDK, the CLI and the
// Terraform provider send IpAddresses, and the CLI will not send the old name at
// all, so reading only the old one made the operation dispatch and stay
// uncallable. These cover both spellings so the alias cannot be dropped silently.
private static String createEndpointBody(String ipMember, String creatorRequestId) {
return "{\"Name\":\"ep\",\"Direction\":\"INBOUND\","
+ "\"CreatorRequestId\":\"" + creatorRequestId + "\","
+ "\"SecurityGroupIds\":[\"sg-abc123\"],"
+ "\"" + ipMember + "\":[{\"SubnetId\":\"subnet-abc\",\"Ip\":\"10.0.0.10\"}]}";
}
@Test
void createResolverEndpoint_acceptsTheAwsIpAddressesMember() {
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "Route53Resolver.CreateResolverEndpoint")
.header("Authorization", AUTH_HEADER)
.body(createEndpointBody("IpAddresses", "aws-member-1"))
.when()
.post("/")
.then()
.statusCode(200)
.body("ResolverEndpoint.Id", startsWith("rslvr-in-"))
.body("ResolverEndpoint.Direction", equalTo("INBOUND"))
.body("ResolverEndpoint.IpAddressCount", equalTo(1));
}
@Test
void createResolverEndpoint_stillAcceptsTheLegacyMember() {
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "Route53Resolver.CreateResolverEndpoint")
.header("Authorization", AUTH_HEADER)
.body(createEndpointBody("IpAddressRequests", "legacy-member-1"))
.when()
.post("/")
.then()
.statusCode(200)
.body("ResolverEndpoint.IpAddressCount", equalTo(1));
}
@Test
void createResolverEndpoint_replayMatchesAcrossTheTwoSpellings() {
// A caller that created an endpoint with the old name and retries with the AWS
// one is sending the same request. The idempotency check compares contents, so
// it must not read the rename as a conflict.
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "Route53Resolver.CreateResolverEndpoint")
.header("Authorization", AUTH_HEADER)
.body(createEndpointBody("IpAddressRequests", "replay-across-names"))
.when().post("/").then().statusCode(200);
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "Route53Resolver.CreateResolverEndpoint")
.header("Authorization", AUTH_HEADER)
.body(createEndpointBody("IpAddresses", "replay-across-names"))
.when()
.post("/")
.then()
.statusCode(200)
.body("ResolverEndpoint.IpAddressCount", equalTo(1));
}
@Test
void createResolverEndpoint_withoutAddressesNamesTheAwsMember() {
// The message is the only hint a caller gets about which member to send, so it
// must name the one AWS documents rather than the emulator's internal spelling.
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "Route53Resolver.CreateResolverEndpoint")
.header("Authorization", AUTH_HEADER)
.body("{\"Name\":\"ep\",\"Direction\":\"INBOUND\","
+ "\"CreatorRequestId\":\"no-addresses\",\"SecurityGroupIds\":[\"sg-abc123\"]}")
.when()
.post("/")
.then()
.statusCode(400)
.body("message", equalTo("IpAddresses is required"));
}
}