Home > Software design >  CloudFormation Elastic load balancer listener circular dependency with listener certificate
CloudFormation Elastic load balancer listener circular dependency with listener certificate

Time:01-11

I have a cloudformation template that is trying to create an application load balancer listener and it also attempts to create a listener certificate. The issue is both resources reference each other. I get a circular dependency error when validating the yaml configuration...

#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

CodePudding user response:

The Certificates shoud be ARN of certificate from ACM, AWS::CertificateManager::Certificate, not your ListenerCertificate.

CodePudding user response:

Marcin was correct. I needed to reference the Certificate (AWS::CertificateManager::Certificate), not ListenerCertificate. Also correct syntax is:

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