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
gefragt vor 3 Jahren333 Aufrufe
1 Antwort
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
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen