Skip to content

Commit 84c92a4

Browse files
authored
2 parents 7686e1d + 21ec0bb commit 84c92a4

File tree

5 files changed

+55
-4
lines changed

5 files changed

+55
-4
lines changed

CHANGELOG.v2.alpha.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.235.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.235.0-alpha.0...v2.235.1-alpha.0) (2026-01-19)
6+
57
## [2.235.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.234.1-alpha.0...v2.235.0-alpha.0) (2026-01-15)
68

79

CHANGELOG.v2.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.235.1](https://github.com/aws/aws-cdk/compare/v2.235.0...v2.235.1) (2026-01-19)
6+
7+
8+
### Bug Fixes
9+
10+
* **apigatewayv2:** use custom domain name instead of regional domain name when importing domain name via fromDomainNameAttributes ([#36710](https://github.com/aws/aws-cdk/issues/36710)) ([29e5642](https://github.com/aws/aws-cdk/commit/29e5642266190ef7d8cf3cccdb50ea2caa6919db))
11+
512
## [2.235.0](https://github.com/aws/aws-cdk/compare/v2.234.1...v2.235.0) (2026-01-15)
613

714

packages/aws-cdk-lib/aws-apigatewayv2/lib/common/domain-name.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ export class DomainName extends Resource implements IDomainName {
180180
public readonly regionalHostedZoneId = attrs.regionalHostedZoneId;
181181
public readonly name = attrs.name;
182182
public readonly domainNameRef: DomainNameReference = {
183-
domainName: attrs.regionalDomainName,
183+
domainName: attrs.name,
184184
domainNameArn: Stack.of(this).formatArn({
185185
service: 'apigateway',
186186
arnFormat: ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME,
187187
resource: 'domainnames',
188-
resourceName: attrs.regionalDomainName,
188+
resourceName: attrs.name,
189189
}),
190190
};
191191
}

packages/aws-cdk-lib/aws-apigatewayv2/test/http/domain-name.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,46 @@ describe('DomainName', () => {
355355
],
356356
});
357357
});
358+
359+
test('imported domain name has correct domainNameRef with custom domain name', () => {
360+
// GIVEN
361+
const stack = new Stack();
362+
363+
// WHEN - import with explicit attributes to verify domainNameRef uses 'name' not 'regionalDomainName'
364+
const importedDomain = DomainName.fromDomainNameAttributes(stack, 'ImportedDomain', {
365+
name: 'api.example.com',
366+
regionalDomainName: 'd-xxxxxxxx.execute-api.us-east-1.amazonaws.com',
367+
regionalHostedZoneId: 'Z1234567890',
368+
});
369+
370+
// THEN - domainNameRef.domainName should return the actual domain name, not the regionalDomainName
371+
expect(importedDomain.domainNameRef.domainName).toEqual('api.example.com');
372+
expect(importedDomain.domainNameRef.domainNameArn).toContain('api.example.com');
373+
});
374+
375+
test('ApiMapping uses custom domain name for imported domain', () => {
376+
// GIVEN
377+
const stack = new Stack();
378+
379+
// Import a domain name with explicit attributes
380+
const importedDomain = DomainName.fromDomainNameAttributes(stack, 'ImportedDomain', {
381+
name: 'api.example.com',
382+
regionalDomainName: 'd-xxxxxxxx.execute-api.us-east-1.amazonaws.com',
383+
regionalHostedZoneId: 'Z1234567890',
384+
});
385+
386+
// WHEN
387+
new HttpApi(stack, 'Api', {
388+
createDefaultStage: true,
389+
defaultDomainMapping: {
390+
domainName: importedDomain,
391+
},
392+
});
393+
394+
// THEN - ApiMapping should use the custom domain name, not the regional domain name
395+
Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::ApiMapping', {
396+
DomainName: 'api.example.com',
397+
Stage: '$default',
398+
});
399+
});
358400
});

version.v2.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "2.235.0",
3-
"alphaVersion": "2.235.0-alpha.0"
2+
"version": "2.235.1",
3+
"alphaVersion": "2.235.1-alpha.0"
44
}

0 commit comments

Comments
 (0)