CloudFormation 弹性负载均衡器侦听器循环依赖与侦听器证书

CloudFormation Elastic load balancer listener circular dependency with listener certificate

我有一个 cloudformation 模板,它正在尝试创建一个应用程序负载平衡器侦听器,它还尝试创建一个侦听器证书。问题是两种资源相互引用。验证 yaml 配置时出现循环依赖错误...

#APPLICATION LOAD BALANCER LISTENER
  ApplicationLoadBalancerListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties: 
      AlpnPolicy: 
        - String
      Certificates: 
        - !Ref ListenerCertificate
      DefaultActions: 
        - Action
      LoadBalancerArn: 
        Ref: ApplicationLoadBalancer
      Port: 443
      Protocol: HTTPS
      SslPolicy: ELBSecurityPolicy-2016-08
  
#APPLICATION LOAD BALANCER LISTENER SSL LINK
  ListenerCertificate:
    Type: AWS::ElasticLoadBalancingV2::ListenerCertificate
    Properties: 
      Certificates: 
        - !Ref SSLCertificate
      ListenerArn:
        Ref: ApplicationLoadBalancerListener

Certificates 应该是来自 ACM AWS::CertificateManager::Certificate 的证书的 ARN,而不是您的 ListenerCertificate

Marcin 是正确的。我需要引用证书 (AWS::CertificateManager::Certificate),而不是 ListenerCertificate。 正确的语法也是:

  ApplicationLoadBalancerListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties: 
      Certificates: 
        - CertificateArn: !Ref SSLCertificate