SimpleAD and CDK: How to reference IP addresses?

0

A SimpleAD has two IP addresses. We want to set up two A-records in a hosted zone that point to those IP addresses.

In the A-record code we tried this (simpleAD is the constructed SimpleAD):

target: route53.RecordTarget.fromIpAddresses(simpleAd.attrDnsIpAddresses[0], simpleAd.attrDnsIpAddresses[1]),

.. but got "Error: Resolution error: Resolution error: Cannot add elements to list token, got: #{Token[TOKEN.163]},.."

We tried adding a dependency (aRecord is the constructed A-record):

aRecord.node.addDependency(simpleAd) ;

... but no change.

So how do we refer to those addresses in a way that lets them be used in the A-record construction?

Any ideas gratefully accepted.

Regards, K.

kauer
asked 3 years ago314 views
1 Answer
0

With the help of this post:

https://github.com/aws/aws-cdk/issues/6475

I ended up with this (working) solution:

  target: route53.RecordTarget.fromIpAddresses(  
    cdk.Fn.select(0, simpleAd.attrDnsIpAddresses),  
    cdk.Fn.select(1, simpleAd.attrDnsIpAddresses),  
  ),  

Thanks, K.

kauer
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions