Skip to content

Commit 6aa0b28

Browse files
committed
fix(rout53): Adding stage suffix for API - A records
1 parent 6d795a6 commit 6aa0b28

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/lib/manager/route53Manager.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ export class Route53Manager {
156156
apiDomain: apig.DomainName,
157157
hostedZone: route53.IHostedZone
158158
) {
159+
let apiRecordName = ''
160+
if (recordName && recordName !== '')
161+
apiRecordName = scope.isProductionStage() ? `${recordName}` : `${recordName}-${scope.props.stage}`
162+
159163
const apiARecord = new route53.ARecord(scope, `${id}`, {
160-
recordName: recordName,
164+
recordName: apiRecordName,
161165
target: route53.RecordTarget.fromAlias(new route53Targets.ApiGatewayDomain(apiDomain)),
162166
zone: hostedZone,
163167
})

src/test/construct/graphQLApiLambda.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ describe('TestGraphQLApiLambdaConstruct', () => {
156156
describe('TestGraphQLApiLambdaConstruct', () => {
157157
test('provisions route53 records as expected', () => {
158158
template.hasResourceProperties('AWS::Route53::RecordSet', {
159-
Name: 'api.test.gradientedge.io.',
159+
Name: 'api-test.test.gradientedge.io.',
160160
Type: 'A',
161161
})
162162
})

src/test/manager/route53Manager.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ describe('TestRoute53Construct', () => {
162162
describe('TestRoute53Construct', () => {
163163
test('provisions new a record as expected', () => {
164164
template.hasResourceProperties('AWS::Route53::RecordSet', {
165-
Name: 'testapi.gradientedge.io.',
165+
Name: 'testapi-test.gradientedge.io.',
166166
Type: 'A',
167167
})
168168
template.hasResourceProperties('AWS::Route53::RecordSet', {

0 commit comments

Comments
 (0)