问题描述
我尝试在 TypeScript 中通过 CDK 创建一个 alb。但是当执行 'cdk deploy' 时,我遇到了以下代码的错误。我如何获得 ALB 的 ARN?
AlbStack Failed: Error [ValidationError]: Template error: resource alb does not support attribute type Arn in Fn::GetAtt
constructor(scope: cdk.Construct,id: string,props?: cdk.StackProps) {
super(scope,id,props);
const target_group = new elbv2.CfnTargetGroup(this,'targetgroup',{
~
});
const alb = new elbv2.CfnLoadBalancer(this,'alb',{
~
});
new elbv2.CfnListener(this,'alblistener80',{
defaultActions: xxx,loadBalancerArn: cdk.Fn.getAtt(alb.logicalId,'Arn').toString(),// <----- Here
port: 80,protocol: 'HTTP',});
}