-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow to register an existing record created manually as an alias ARecord target #29565
Conversation
constructor(private readonly ArecordAttrs: ARecordAttrs) { | ||
} | ||
|
||
public bind(_record: IRecordSet, _zone?: IHostedZone | undefined): AliasRecordTargetConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this bind
method for and where is it used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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