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
已提問 3 年前檢視次數 333 次
1 個回答
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
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南