diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts index dca1a60bd4548..6b1123512c678 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts @@ -98,7 +98,7 @@ export class DomainName extends Resource implements IDomainName { ], }; const resource = new CfnDomainName(this, 'Resource', domainNameProps); - this.name = props.domainName ?? resource.ref; + this.name = resource.ref; this.regionalDomainName = Token.asString(resource.getAtt('RegionalDomainName')); this.regionalHostedZoneId = Token.asString(resource.getAtt('RegionalHostedZoneId')); } diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts index 30c981a1da1d5..2d0d856c7ae15 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts @@ -102,7 +102,9 @@ describe('DomainName', () => { ApiId: { Ref: 'ApiF70053CD', }, - DomainName: 'example.com', + DomainName: { + Ref: 'DNFDC76583', + }, Stage: 'beta', ApiMappingKey: 'beta', }); @@ -139,7 +141,9 @@ describe('DomainName', () => { ApiId: { Ref: 'ApiF70053CD', }, - DomainName: 'example.com', + DomainName: { + Ref: 'DNFDC76583', + }, Stage: '$default', }); });