-
Notifications
You must be signed in to change notification settings - Fork 4.4k
aws_route53: cannot use CfnParameter.valueAsNumber for L2 RecordSet weight #31810
Copy link
Copy link
Closed
Closed
Copy link
Labels
@aws-cdk/aws-route53Related to Amazon Route 53Related to Amazon Route 53bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2
Description
Describe the bug
Cannot construct ARecord (and presumably any RecordSet) with weight resolved by CfnParameter value.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
RecordSet should successfully be synthesized with the parameter's token value for the weight.
Current Behavior
Synthesis fails, token value representing a number outside the bounds of a valid weight (0-255).
Error: weight must be between 0 and 255 inclusive, got: -1.888154589708757e+289
at new RecordSet (/.../node_modules/aws-cdk-lib/aws-route53/lib/record-set.js:1:3296)
at new ARecord (/.../node_modules/aws-cdk-lib/aws-route53/lib/record-set.js:1:7665)
...
Reproduction Steps
import { aws_route53 as r53, CfnParameter } from 'aws-cdk-lib';
const weightParameter: CfnParameter = new CfnParameter(this, 'Weight', {
default: 0,
maxValue: 255,
minValue: 0,
type: 'Number'
});
const zone = r53.HostedZone.fromLookup(this, 'HostedZone', {
domainName: 'example.com'
});
const aRecord = new r53.ARecord(this, 'ARecord', {
weight: weightParameter.valueAsNumber,
zone
});Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.151.0 (build b8289e2)
Framework Version
No response
Node.js Version
v20.13.1
OS
Linux 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 GNU/Linux
Language
TypeScript
Language Version
No response
Other information
Currently using this workaround:
...
const aRecord = new r53.ARecord(this, 'ARecord', {
weight: 0,
zone
});
(aRecord.node.defaultChild as r53.CfnRecordSet).addPropertyOverride('Weight', weightParameter.valueAsNumber);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-route53Related to Amazon Route 53Related to Amazon Route 53bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2