feat: allow to register an existing record created manually as an alias ARecord target #29565
feat: allow to register an existing record created manually as an alias ARecord target #29565mergify[bot] merged 12 commits intoaws:mainfrom
Conversation
| constructor(private readonly ArecordAttrs: ARecordAttrs) { | ||
| } | ||
|
|
||
| public bind(_record: IRecordSet, _zone?: IHostedZone | undefined): AliasRecordTargetConfig { |
There was a problem hiding this comment.
What is this bind method for and where is it used?
There was a problem hiding this comment.
this bind method is used by class RecordSet to set aliasTarget here
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-route53/lib/record-set.ts#L336
We use similar mechanism to set target like apigw etc. here
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-route53-targets/lib/api-gatewayv2-domain-name.ts
In this case, what will happen this piece of code target.aliasTarget.bind(this,hostedzone) will bind new Arecord with target DNS name set to input DNS name as we have defined in this public bind
dnsName: this.aRrecordAttrs.targetDNS
| * Use to import given A record DNS name created outside CDK and return it as AliasRecordTarget | ||
| */ | ||
| class ImportARecordAsTarget implements IAliasRecordTarget { | ||
| constructor(private readonly ArecordAttrs: ARecordAttrs) { |
There was a problem hiding this comment.
| constructor(private readonly ArecordAttrs: ARecordAttrs) { | |
| constructor(private readonly aRecordAttrs: ARecordAttrs) { |
Co-authored-by: paulhcsun <47882901+paulhcsun@users.noreply.github.com>
...-cdk-testing/framework-integ/test/aws-route53/test/integ.import-existing-record-as-target.ts
Outdated
Show resolved
Hide resolved
…t/integ.import-existing-record-as-target.ts
paulhcsun
left a comment
There was a problem hiding this comment.
Looks good, nice work!!
|
@Mergifyio update |
✅ Branch has been successfully updated |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Issue # (if applicable)
Closes #23048.
Reason for this change
Currently an existing A record created outside of CDK cannot be registered as an Alias Target under a new A record, while this is possible through AWS console.
Description of changes
Introduces new function under class Arecord which will take input as existing record DNS name and then register it as an alias target under new Arecord. This way user will be able to alias an existing record (for type ARecord only).
Description of how you validated changes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license