AWS/CDK: How to create ARecord Target, having CfnEIPAssociation?

Viewed 909

For a newly allocated IP, it would be something like this in C# (using .Ref):

var arNewPublic = new ARecord(this, $"ARecord_Public_NewAlloc", new ARecordProps
{
  ...
  Target = RecordTarget.FromValues(newElasticIPs.Select(eip => eip.Ref).ToArray())
  ...

But how to create ARecord target for a CfnEIPAssociation?

Doing it like that:

Target = RecordTarget.FromValues(elasticIPAssociations.Select(eipa => eipa.Eip).ToArray()),

throws:

Unhandled exception. Amazon.JSII.Runtime.JsiiException: Got 'undefined' for non-optional instance of {"name":"values","type":{"primitive":"string"},"variadic":true}

or crashes CF deployment:

Target = RecordTarget.FromValues(elasticIPAssociations.Select(eipa => eipa.Ref).ToArray()),

9/12 | 1:58:11 PM | CREATE_FAILED | AWS::Route53::RecordSet | ARecord-Public-PreAlloc (ARecordPublicPreAllocCB385358) [Invalid Resource Record: FATAL problem: ARRDATAIllegalIPv4Address (Value is not a valid IPv4 address) encountered with 'eipassoc-0f9299c9975d21e6e'] new RecordSet (...@aws-cdk\aws-route53\lib\record-set.js:134:27)

0 Answers
Related