You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When delete_existing=True, and something goes awry from another resource related to the A record (see below for reproduction steps), I am seeing the custom resource run twice so the a record gets created, then deleted, then created, and then finally deleted so by the time the stack finishes updating, there's no A record at all.
Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
The existing a record gets deleted and then created with the new value.
Current Behavior
By the time the stack finishes updating, there's no A record at all.
Reproduction Steps
Deploy with:
• An A record with delete_existing=True
• An ALB w/ protocol=lb.ApplicationProtocol.HTTP
Attempt to move ALB to protocol=lb.ApplicationProtocol.HTTPS which may require domain_name and domain_zone to be set. In my case there was a mistake in here somewhere, and the domain_name got set to some other value (i.e. original value was api.dev.example.com an the new domain_name gets set to just dev.example.com), the A record was deleted and recreated with the new record name.
Try to force Cfn to recreate the record set by changing the logicalid of the A record
Experience error
Possible Solution
Detect if the a record has already been deleted and (re)created by the custom resource and if so, don't run the CR again.
Additional Information/Context
No response
CDK CLI Version
2.1000.3 (build 321a46a)
Framework Version
No response
Node.js Version
v22.12.0
OS
Mac
Language
Python
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered:
Hey @BwL1289, thank you for reporting this issue and providing us the logs. On diving into this issue, I was able to observe the following when reproducing this issue.
CDK versions
"aws-cdk-lib": "2.191.0",
"aws-cdk": "^2.1012.0"
Reproduction Steps:
Created a CDK stack with a Route53 PublicHostedZone and an ARecord:
exportclassRoute53IssueStackextendscdk.Stack{constructor(scope: Construct,id: string,props?: cdk.StackProps){super(scope,id,props);// Step 1: Create a VPCconstvpc=newec2.Vpc(this,'VPC',{maxAzs: 2,natGateways: 0,});// Step 1: Create an ALBconstalb=newelbv2.ApplicationLoadBalancer(this,'ALB',{
vpc,internetFacing: true,});// Create a hosted zoneconsthostedZone=newroute53.PublicHostedZone(this,'HostedZone',{zoneName: 'mydemo-domain.net',});// Create an A recordnewroute53.ARecord(this,'ARecord',{zone: hostedZone,recordName: 'api.dev.mydemo-domain.net',target: route53.RecordTarget.fromAlias(newtargets.LoadBalancerTarget(alb)),deleteExisting: true,});// Add HTTP listeneralb.addListener('HttpListener',{port: 80,protocol: elbv2.ApplicationProtocol.HTTP,defaultAction: elbv2.ListenerAction.fixedResponse(200,{contentType: 'text/plain',messageBody: 'OK',}),});}}
ran cdk synth && cdk deploy, the deploy was succesfull
Updated zoneName and recordName:
// Create a hosted zoneconsthostedZone=newroute53.PublicHostedZone(this,'HostedZone',{zoneName: 'mydemo-domain-abc.net',});// Create an A recordnewroute53.ARecord(this,'ARecord',{zone: hostedZone,recordName: 'api.dev.mydemo-domain-abc.net',target: route53.RecordTarget.fromAlias(newtargets.LoadBalancerTarget(alb)),deleteExisting: true,});
ran cdk synth
HostedZoneDB99F866:
Type: AWS::Route53::HostedZoneProperties:
Name: mydemo-domain.net. # Should be mydemo-domain-abc.net.
Tried clearing the CDK context with cdk context --clear and re-synthesizing, the issue persists.
Describe the bug
It's possible there's some user error in here.
When
delete_existing=True
, and something goes awry from another resource related to the A record (see below for reproduction steps), I am seeing the custom resource run twice so the a record gets created, then deleted, then created, and then finally deleted so by the time the stack finishes updating, there's no A record at all.Here are the logs:
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The existing a record gets deleted and then created with the new value.
Current Behavior
By the time the stack finishes updating, there's no A record at all.
Reproduction Steps
• An A record with
delete_existing=True
• An ALB w/
protocol=lb.ApplicationProtocol.HTTP
protocol=lb.ApplicationProtocol.HTTPS
which may requiredomain_name
anddomain_zone
to be set. In my case there was a mistake in here somewhere, and thedomain_name
got set to some other value (i.e. original value wasapi.dev.example.com
an the newdomain_name
gets set to justdev.example.com
), the A record was deleted and recreated with the new record name.Possible Solution
Detect if the a record has already been deleted and (re)created by the custom resource and if so, don't run the CR again.
Additional Information/Context
No response
CDK CLI Version
2.1000.3 (build 321a46a)
Framework Version
No response
Node.js Version
v22.12.0
OS
Mac
Language
Python
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: