Skip to content

Commit

Permalink
fix(apigatewayv2): ApiMapping does not depend on DomainName
Browse files Browse the repository at this point in the history
When an ApiMapping resource is deployed using the Domain defined in the
DomainName resource, the DomainName resource must be deployed before the
ApiMapping resource.

Since the current logic uses the CloudFormation Output of DomainName as
a fall back, preferring the user provided string first, this dependency
is not expressed in the resulting template.

Remove the preference for the user provided string, will inform
synthesis that the dependency must be declared.

fixes #15464
  • Loading branch information
Niranjan Jayakar committed Aug 24, 2021
1 parent 9c39bcb commit 6e3448a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ describe('DomainName', () => {
ApiId: {
Ref: 'ApiF70053CD',
},
DomainName: 'example.com',
DomainName: {
Ref: 'DNFDC76583',
},
Stage: 'beta',
ApiMappingKey: 'beta',
});
Expand Down Expand Up @@ -139,7 +141,9 @@ describe('DomainName', () => {
ApiId: {
Ref: 'ApiF70053CD',
},
DomainName: 'example.com',
DomainName: {
Ref: 'DNFDC76583',
},
Stage: '$default',
});
});
Expand Down

0 comments on commit 6e3448a

Please sign in to comment.