apoorvmote / cdk-examples

These are CDK template/patterns that I came across my journey with AWS CDK.
https://apoorv.blog
MIT License
38 stars 12 forks source link

ARecord needs recordName #1

Open wardtc opened 1 year ago

wardtc commented 1 year ago

in http-api-stack.ts the record name is missing from ARecord construct

new ARecord(this, 'apiAliasRecord', {
      zone: hostedZone,
      target: RecordTarget.fromAlias(new ApiGatewayv2DomainProperties(domain.regionalDomainName, domain.regionalHostedZoneId))
})

should be

new ARecord(this, 'apiAliasRecord', {
      zone: hostedZone,
      recordName: api_domain,
      target: RecordTarget.fromAlias(new ApiGatewayv2DomainProperties(domain.regionalDomainName, domain.regionalHostedZoneId))
})
apoorvmote commented 1 year ago

I haven't been maintaining it for while and as I see in documentation recordName is optional and you can get api domain from zone itself. No need to repeat it twice.

const hostedZone = HostedZone.fromHostedZoneAttributes(this, 'hostedZoneWithAttr', {
      hostedZoneId: hostedZoneId,
      zoneName: api_domain
    })